$default_loop = Bunyad::archives()->get_default_loop(); $heading = Bunyad::archives()->get_heading(); // Fallbacks if theme helper returns empty: if (empty($heading)) { // Standard WP archive title (categories, tags, tax, dates, CPT archives, authors) $heading = get_the_archive_title(); } if (empty($heading) && is_home()) { // If using a static Posts page, show that page title; else just "Blog" $heading = get_the_title(get_option('page_for_posts')) ?: __('Blog', 'textdomain'); } if (empty($heading) && is_post_type_archive()) { // CPT archive label as a last resort $post_type = get_query_var('post_type'); $obj = get_post_type_object(is_array($post_type) ? reset($post_type) : $post_type); if ($obj && !empty($obj->labels->name)) { $heading = $obj->labels->name; } }