', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'bike_workshop_pingback_header' ); /** * Get all posts for customizer Post content type. */ function bike_workshop_get_post_choices() { $bike_workshop_choices = array( '' => esc_html__( '--Select--', 'bike-workshop' ) ); $bike_workshop_args = array( 'numberposts' => -1 ); $bike_workshop_posts = get_posts( $bike_workshop_args ); foreach ( $bike_workshop_posts as $bike_workshop_post ) { $bike_workshop_id = $bike_workshop_post->ID; $bike_workshop_title = $bike_workshop_post->post_title; $bike_workshop_choices[ $bike_workshop_id ] = $bike_workshop_title; } return $bike_workshop_choices; } /** * Get all pages for customizer Page content type. */ function bike_workshop_get_page_choices() { $bike_workshop_choices = array( '' => esc_html__( '--Select--', 'bike-workshop' ) ); $bike_workshop_pages = get_pages(); foreach ( $bike_workshop_pages as $bike_workshop_page ) { $bike_workshop_choices[ $bike_workshop_page->ID ] = $bike_workshop_page->post_title; } return $bike_workshop_choices; } if ( ! function_exists( 'bike_workshop_excerpt_length' ) ) : /** * Excerpt length. */ function bike_workshop_excerpt_length( $bike_workshop_length ) { if ( is_admin() ) { return $bike_workshop_length; } return get_theme_mod( 'bike_workshop_excerpt_length', 20 ); } endif; add_filter( 'excerpt_length', 'bike_workshop_excerpt_length', 999 ); if ( ! function_exists( 'bike_workshop_excerpt_more' ) ) : /** * Excerpt more. */ function bike_workshop_excerpt_more( $bike_workshop_more ) { if ( is_admin() ) { return $bike_workshop_more; } return '…'; } endif; add_filter( 'excerpt_more', 'bike_workshop_excerpt_more' ); if ( ! function_exists( 'bike_workshop_sidebar_layout' ) ) { /** * Get sidebar layout. */ function bike_workshop_sidebar_layout() { $bike_workshop_sidebar_position = get_theme_mod( 'bike_workshop_sidebar_position', 'right-sidebar' ); $bike_workshop_sidebar_position_post = get_theme_mod( 'bike_workshop_post_sidebar_position', 'right-sidebar' ); $bike_workshop_sidebar_position_page = get_theme_mod( 'bike_workshop_page_sidebar_position', 'right-sidebar' ); if ( is_single() ) { $bike_workshop_sidebar_position = $bike_workshop_sidebar_position_post; } elseif ( is_page() ) { $bike_workshop_sidebar_position = $bike_workshop_sidebar_position_page; } return $bike_workshop_sidebar_position; } } if ( ! function_exists( 'bike_workshop_is_sidebar_enabled' ) ) { /** * Check if sidebar is enabled. */ function bike_workshop_is_sidebar_enabled() { $bike_workshop_sidebar_position = get_theme_mod( 'bike_workshop_sidebar_position', 'right-sidebar' ); $bike_workshop_sidebar_position_post = get_theme_mod( 'bike_workshop_post_sidebar_position', 'right-sidebar' ); $bike_workshop_sidebar_position_page = get_theme_mod( 'bike_workshop_page_sidebar_position', 'right-sidebar' ); $bike_workshop_sidebar_enabled = true; if ( is_home() || is_archive() || is_search() ) { if ( 'no-sidebar' === $bike_workshop_sidebar_position ) { $bike_workshop_sidebar_enabled = false; } } elseif ( is_single() ) { if ( 'no-sidebar' === $bike_workshop_sidebar_position || 'no-sidebar' === $bike_workshop_sidebar_position_post ) { $bike_workshop_sidebar_enabled = false; } } elseif ( is_page() ) { if ( 'no-sidebar' === $bike_workshop_sidebar_position || 'no-sidebar' === $bike_workshop_sidebar_position_page ) { $bike_workshop_sidebar_enabled = false; } } return $bike_workshop_sidebar_enabled; } } if ( ! function_exists( 'bike_workshop_get_homepage_sections ' ) ) { /** * Returns homepage sections. */ function bike_workshop_get_homepage_sections() { $bike_workshop_sections = array( 'banner' => esc_html__( 'Banner Section', 'bike-workshop' ), 'bike-services' => esc_html__( 'Bike Services Section', 'bike-workshop' ), ); return $bike_workshop_sections; } } /** * Renders customizer section link */ function bike_workshop_section_link( $bike_workshop_section_id ) { $bike_workshop_section_name = str_replace( 'bike_workshop_', ' ', $bike_workshop_section_id ); $bike_workshop_section_name = str_replace( '_', ' ', $bike_workshop_section_name ); $bike_workshop_starting_notation = '#'; ?> false, 'show_title' => true, 'show_browse' => false, ); breadcrumb_trail( $bike_workshop_args ); } add_action( 'bike_workshop_breadcrumb', 'bike_workshop_breadcrumb', 10 ); /** * Add separator for breadcrumb trail. */ function bike_workshop_breadcrumb_trail_print_styles() { $bike_workshop_breadcrumb_separator = get_theme_mod( 'bike_workshop_breadcrumb_separator', '/' ); $bike_workshop_style = ' .trail-items li::after { content: "' . $bike_workshop_breadcrumb_separator . '"; }'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $bike_workshop_style = apply_filters( 'bike_workshop_breadcrumb_trail_inline_style', trim( str_replace( array( "\r", "\n", "\t", ' ' ), '', $bike_workshop_style ) ) ); if ( $bike_workshop_style ) { echo "\n" . '' . "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } add_action( 'wp_head', 'bike_workshop_breadcrumb_trail_print_styles' ); /** * Pagination for archive. */ function bike_workshop_render_posts_pagination() { $bike_workshop_is_pagination_enabled = get_theme_mod( 'bike_workshop_enable_pagination', true ); if ( $bike_workshop_is_pagination_enabled ) { $bike_workshop_pagination_type = get_theme_mod( 'bike_workshop_pagination_type', 'default' ); if ( 'default' === $bike_workshop_pagination_type ) : the_posts_navigation(); else : the_posts_pagination(); endif; } } add_action( 'bike_workshop_posts_pagination', 'bike_workshop_render_posts_pagination', 10 ); /** * Pagination for single post. */ function bike_workshop_render_post_navigation() { the_post_navigation( array( 'prev_text' => '⟵ ', 'next_text' => ' ⟶', ) ); } add_action( 'bike_workshop_post_navigation', 'bike_workshop_render_post_navigation' ); /** * Adds footer copyright text. */ function bike_workshop_output_footer_copyright_content() { $bike_workshop_theme_data = wp_get_theme(); $bike_workshop_copyright_text = get_theme_mod('bike_workshop_footer_copyright_text'); if (!empty($bike_workshop_copyright_text)) { $bike_workshop_text = $bike_workshop_copyright_text; } else { $bike_workshop_default_text = ' ' . esc_html($bike_workshop_theme_data->get('Name')) . '' . ' ' . esc_html__('by', 'bike-workshop') . ' ' . esc_html(ucwords($bike_workshop_theme_data->get('Author'))) . ''; /* translators: %s: WordPress.org URL */ $bike_workshop_default_text .= sprintf(esc_html__(' | Powered by %s', 'bike-workshop'), 'WordPress. '); $bike_workshop_text = $bike_workshop_default_text; } ?>
admin_url( 'admin-ajax.php' ) ) ); wp_enqueue_style( 'bike-workshop-notice-style', get_template_directory_uri() . '/resource/css/notice.css' ); } add_action( 'admin_enqueue_scripts', 'bike_workshop_getpage_css' ); add_action('wp_ajax_bike_workshop_dismissable_notice', 'bike_workshop_dismissable_notice'); function bike_workshop_switch_theme() { delete_user_meta(get_current_user_id(), 'bike_workshop_dismissable_notice'); } add_action('after_switch_theme', 'bike_workshop_switch_theme'); function bike_workshop_dismissable_notice() { update_user_meta(get_current_user_id(), 'bike_workshop_dismissable_notice', true); die(); } function bike_workshop_deprecated_hook_admin_notice() { global $pagenow; // Check if the current page is the one where you don't want the notice to appear if ( $pagenow === 'themes.php' && isset( $_GET['page'] ) && $_GET['page'] === 'bike-workshop-getting-started' ) { return; } $dismissed = get_user_meta( get_current_user_id(), 'bike_workshop_dismissable_notice', true ); if ( !$dismissed) { ?>