', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'bakery_confectionery_pingback_header' ); /** * Get all posts for customizer Post content type. */ function bakery_confectionery_get_post_choices() { $bakery_confectionery_choices = array( '' => esc_html__( '--Select--', 'bakery-confectionery' ) ); $bakery_confectionery_args = array( 'numberposts' => -1 ); $bakery_confectionery_posts = get_posts( $bakery_confectionery_args ); foreach ( $bakery_confectionery_posts as $bakery_confectionery_post ) { $bakery_confectionery_id = $bakery_confectionery_post->ID; $bakery_confectionery_title = $bakery_confectionery_post->post_title; $bakery_confectionery_choices[ $bakery_confectionery_id ] = $bakery_confectionery_title; } return $bakery_confectionery_choices; } /** * Get all pages for customizer Page content type. */ function bakery_confectionery_get_page_choices() { $bakery_confectionery_choices = array( '' => esc_html__( '--Select--', 'bakery-confectionery' ) ); $bakery_confectionery_pages = get_pages(); foreach ( $bakery_confectionery_pages as $bakery_confectionery_page ) { $bakery_confectionery_choices[ $bakery_confectionery_page->ID ] = $bakery_confectionery_page->post_title; } return $bakery_confectionery_choices; } /** * Get all categories for customizer Category content type. */ function bakery_confectionery_get_post_cat_choices() { $bakery_confectionery_choices = array( '' => esc_html__( '--Select--', 'bakery-confectionery' ) ); $bakery_confectionery_cats = get_categories(); foreach ( $bakery_confectionery_cats as $bakery_confectionery_cat ) { $bakery_confectionery_choices[ $bakery_confectionery_cat->term_id ] = $bakery_confectionery_cat->name; } return $bakery_confectionery_choices; } /** * Get all donation forms for customizer form content type. */ function bakery_confectionery_get_post_donation_form_choices() { $bakery_confectionery_choices = array( '' => esc_html__( '--Select--', 'bakery-confectionery' ) ); $bakery_confectionery_posts = get_posts( array( 'post_type' => 'give_forms', 'numberposts' => -1, ) ); foreach ( $bakery_confectionery_posts as $bakery_confectionery_post ) { $bakery_confectionery_choices[ $bakery_confectionery_post->ID ] = $bakery_confectionery_post->post_title; } return $bakery_confectionery_choices; } if ( ! function_exists( 'bakery_confectionery_excerpt_length' ) ) : /** * Excerpt length. */ function bakery_confectionery_excerpt_length( $bakery_confectionery_length ) { if ( is_admin() ) { return $bakery_confectionery_length; } return get_theme_mod( 'bakery_confectionery_excerpt_length', 20 ); } endif; add_filter( 'excerpt_length', 'bakery_confectionery_excerpt_length', 999 ); if ( ! function_exists( 'bakery_confectionery_excerpt_more' ) ) : /** * Excerpt more. */ function bakery_confectionery_excerpt_more( $bakery_confectionery_more ) { if ( is_admin() ) { return $bakery_confectionery_more; } return '…'; } endif; add_filter( 'excerpt_more', 'bakery_confectionery_excerpt_more' ); if ( ! function_exists( 'bakery_confectionery_sidebar_layout' ) ) { /** * Get sidebar layout. */ function bakery_confectionery_sidebar_layout() { $bakery_confectionery_sidebar_position = get_theme_mod( 'bakery_confectionery_sidebar_position', 'right-sidebar' ); $bakery_confectionery_sidebar_position_post = get_theme_mod( 'bakery_confectionery_post_sidebar_position', 'right-sidebar' ); $bakery_confectionery_sidebar_position_page = get_theme_mod( 'bakery_confectionery_page_sidebar_position', 'right-sidebar' ); if ( is_home() ) { $bakery_confectionery_sidebar_position = $bakery_confectionery_sidebar_position_post; } elseif ( is_page() ) { $bakery_confectionery_sidebar_position = $bakery_confectionery_sidebar_position_page; } return $bakery_confectionery_sidebar_position; } } if ( ! function_exists( 'bakery_confectionery_is_sidebar_enabled' ) ) { /** * Check if sidebar is enabled. */ function bakery_confectionery_is_sidebar_enabled() { $bakery_confectionery_sidebar_position = get_theme_mod( 'bakery_confectionery_sidebar_position', 'right-sidebar' ); $bakery_confectionery_sidebar_position_post = get_theme_mod( 'bakery_confectionery_post_sidebar_position', 'right-sidebar' ); $bakery_confectionery_sidebar_position_page = get_theme_mod( 'bakery_confectionery_page_sidebar_position', 'right-sidebar' ); $bakery_confectionery_sidebar_enabled = true; if ( is_single() || is_archive() || is_search() ) { if ( 'no-sidebar' === $bakery_confectionery_sidebar_position ) { $bakery_confectionery_sidebar_enabled = false; } } elseif ( is_home() ) { if ( 'no-sidebar' === $bakery_confectionery_sidebar_position || 'no-sidebar' === $bakery_confectionery_sidebar_position_post ) { $bakery_confectionery_sidebar_enabled = false; } } elseif ( is_page() ) { if ( 'no-sidebar' === $bakery_confectionery_sidebar_position || 'no-sidebar' === $bakery_confectionery_sidebar_position_page ) { $bakery_confectionery_sidebar_enabled = false; } } return $bakery_confectionery_sidebar_enabled; } } if ( ! function_exists( 'bakery_confectionery_get_homepage_sections ' ) ) { /** * Returns homepage sections. */ function bakery_confectionery_get_homepage_sections() { $bakery_confectionery_sections = array( 'banner' => esc_html__( 'Banner Section', 'bakery-confectionery' ), 'product' => esc_html__( 'bakery-confectionery Section', 'bakery-confectionery' ), ); return $bakery_confectionery_sections; } } /** * Renders customizer section link */ function bakery_confectionery_section_link( $bakery_confectionery_section_id ) { $bakery_confectionery_section_name = str_replace( 'bakery_confectionery_', ' ', $bakery_confectionery_section_id ); $bakery_confectionery_section_name = str_replace( '_', ' ', $bakery_confectionery_section_name ); $bakery_confectionery_starting_notation = '#'; ?> false, 'show_title' => true, 'show_browse' => false, ); breadcrumb_trail( $bakery_confectionery_args ); } add_action( 'bakery_confectionery_breadcrumb', 'bakery_confectionery_breadcrumb', 10 ); /** * Add separator for breadcrumb trail. */ function bakery_confectionery_breadcrumb_trail_print_styles() { $bakery_confectionery_breadcrumb_separator = get_theme_mod( 'bakery_confectionery_breadcrumb_separator', '/' ); $bakery_confectionery_style = ' .trail-items li::after { content: "' . $bakery_confectionery_breadcrumb_separator . '"; }'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $bakery_confectionery_style = apply_filters( 'bakery_confectionery_breadcrumb_trail_inline_style', trim( str_replace( array( "\r", "\n", "\t", ' ' ), '', $bakery_confectionery_style ) ) ); if ( $bakery_confectionery_style ) { echo "\n" . '' . "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } add_action( 'wp_head', 'bakery_confectionery_breadcrumb_trail_print_styles' ); /** * Pagination for archive. */ function bakery_confectionery_render_posts_pagination() { $bakery_confectionery_is_pagination_enabled = get_theme_mod( 'bakery_confectionery_enable_pagination', true ); if ( $bakery_confectionery_is_pagination_enabled ) { $bakery_confectionery_pagination_type = get_theme_mod( 'bakery_confectionery_pagination_type', 'default' ); if ( 'default' === $bakery_confectionery_pagination_type ) : the_posts_navigation(); else : the_posts_pagination(); endif; } } add_action( 'bakery_confectionery_posts_pagination', 'bakery_confectionery_render_posts_pagination', 10 ); /** * Pagination for single post. */ function bakery_confectionery_render_post_navigation() { the_post_navigation( array( 'prev_text' => '⟵ ', 'next_text' => ' ⟶', ) ); } add_action( 'bakery_confectionery_post_navigation', 'bakery_confectionery_render_post_navigation' ); /** * Adds footer copyright text. */ function bakery_confectionery_output_footer_copyright_content() { $bakery_confectionery_theme_data = wp_get_theme(); $bakery_confectionery_copyright_text = get_theme_mod('bakery_confectionery_footer_copyright_text'); if (!empty($bakery_confectionery_copyright_text)) { $bakery_confectionery_text = $bakery_confectionery_copyright_text; } else { $bakery_confectionery_default_text = ' ' . esc_html($bakery_confectionery_theme_data->get('Name')) . '' . ' ' . esc_html__('by', 'bakery-confectionery') . ' ' . esc_html(ucwords($bakery_confectionery_theme_data->get('Author'))) . ''; /* translators: %s: WordPress.org URL */ $bakery_confectionery_default_text .= sprintf(esc_html__(' | Powered by %s', 'bakery-confectionery'), 'WordPress. '); $bakery_confectionery_text = $bakery_confectionery_default_text; } ?>
admin_url( 'admin-ajax.php' ) ) ); wp_enqueue_style( 'bakery-confectionery-notice-style', get_template_directory_uri() . '/resource/css/notice.css' ); } add_action( 'admin_enqueue_scripts', 'bakery_confectionery_getpage_css' ); add_action('wp_ajax_bakery_confectionery_dismissable_notice', 'bakery_confectionery_dismissable_notice'); function bakery_confectionery_switch_theme() { delete_user_meta(get_current_user_id(), 'bakery_confectionery_dismissable_notice'); } add_action('after_switch_theme', 'bakery_confectionery_switch_theme'); function bakery_confectionery_dismissable_notice() { update_user_meta(get_current_user_id(), 'bakery_confectionery_dismissable_notice', true); die(); } function bakery_confectionery_deprecated_hook_admin_notice() { global $bakery_confectionery_pagenow; // Check if the current page is the one where you don't want the notice to appear if ( $bakery_confectionery_pagenow === 'themes.php' && isset( $_GET['page'] ) && $_GET['page'] === 'bakery-confectionery-getting-started' ) { return; } $dismissed = get_user_meta( get_current_user_id(), 'bakery_confectionery_dismissable_notice', true ); if ( !$dismissed) { ?>