', esc_url(get_bloginfo('pingback_url'))); } } add_action('wp_head', 'blog_build_pingback_header'); /** * Custom pagination function for Blog Build theme * * Displays pagination with ellipses and custom styling */ function blog_build_pagination() { the_posts_pagination(array( 'mid_size' => 1, 'prev_text' => __('Previous', 'blog-build'), 'next_text' => __('Next', 'blog-build'), 'screen_reader_text' => __('Posts Navigation', 'blog-build'), 'aria_label' => __('Posts', 'blog-build'), 'class' => 'blog-build-pagination', )); } function blog_build_sanitize_footer_copyright($input) { $allowed_html = array( 'a' => array( 'href' => array(), 'title' => array(), 'class' => array(), 'target' => array(), 'rel' => array(), ), 'p' => array( 'class' => array(), ), 'span' => array( 'class' => array(), ), ); return wp_kses($input, $allowed_html); } /** * Display category badge(s) for posts * * @param bool $single Whether to display a single random category (true) or all categories (false) */ function blog_build_display_random_category_badge($single = true) { $blog_build_show_categories = get_theme_mod('blog_build_show_categories'); $blog_build_single_show_categories = get_theme_mod('blog_build_single_show_categories', 1); if ('post' != get_post_type()) { return; // Only for posts } if ( empty($blog_build_show_categories) && !is_single() ) { return; } if ( empty($blog_build_single_show_categories) && is_single() ) { return; } // Static variables preserve value between function calls static $post_index = 0; // Define background color classes (you can customize these) $bg_classes = array('cat-bg-1', 'cat-bg-2', 'cat-bg-3', 'cat-bg-4', 'cat-bg-5', 'cat-bg-6'); // Increment post index $post_index++; // Get categories $categories = get_the_category(); if (!empty($categories)) { if ($single) { // Display a single random category (original behavior) $random_cat_index = array_rand($categories); $random_cat = $categories[$random_cat_index]; $current_color_class = $bg_classes[($post_index - 1) % 6]; echo '' . esc_html($random_cat->name) . ''; } else { // Display all categories with rotating background colors // Open wrapper div for multiple categories echo '