Skip to content

Instantly share code, notes, and snippets.

@mandiwise
Last active November 30, 2015 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mandiwise/6f16188c1a4fabe826e5 to your computer and use it in GitHub Desktop.
Save mandiwise/6f16188c1a4fabe826e5 to your computer and use it in GitHub Desktop.
Customize archive title in WP
<?php
/**
* Customize the Product archive title
*/
function red_archive_title( $title ) {
if ( is_post_type_archive( 'product' ) ) {
$title = 'Our Products Are Made Fresh Daily';
} elseif ( is_tax( 'product-type' ) ) {
$title = sprintf( '%1$s', single_term_title( '', false ) );
} elseif ( is_post_type_archive( 'testimonial' ) ) {
$title = 'Testimonials';
}
return $title;
}
add_filter( 'get_the_archive_title', 'red_archive_title' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment