Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Empty Archive
- if ( is_404() && is_archive() ) : $page_title = 'Nothing Available';
- // 404 Page
- elseif ( is_404() && !is_archive() ) : $page_title = 'Nothing Found';
- // Single Page
- elseif ( is_page() ) : $page_title = get_the_title();
- // Custom Post Archives
- elseif ( is_post_type_archive() ) : $page_title = $wp_query->queried_object->label; // Custom post archive
- elseif ( is_tax() ) : $page_title = $wp_query->queried_object->name; // Custom taxonomy archive
- // Blog Archives
- elseif ( is_home() ) : $page_title = 'Latest Posts';
- elseif ( is_category() ): $page_title = 'Category Archives: <span>'. single_cat_title('', false) .'</span>';
- elseif ( is_tag() ) : $page_title = 'Tag Archives: <span>'. single_tag_title('', false) .'</span>';
- elseif ( is_author() ) : $page_title = 'Author Archives: <span>'. get_the_author(). '</span>';
- elseif ( is_day() ) : $page_title = 'Daily Archives: <span>'. get_the_date(). '</span>';
- elseif ( is_month() ) : $page_title = 'Monthly Archives: <span>'. get_the_date( 'F Y' ) .'</span>';
- elseif ( is_year() ) : $page_title = 'Yearly Archives: <span>'. get_the_date( 'Y' ) .'</span>';
- // Defaults to the title of the first post within the main query
- else : $page_title = get_the_title();
- // End of the whole IF
- endif;
- // Output the H1 ?>
- <h1 class="entry-title page-title"><?php echo $page_title; ?></h1>
Add Comment
Please, Sign In to add comment