Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. // Return an alternate title, without prefix, for every type used in the get_the_archive_title().
  2. add_filter('get_the_archive_title', function ($title) {
  3. if ( is_category() ) {
  4. $title = single_cat_title( '', false );
  5. } elseif ( is_tag() ) {
  6. $title = single_tag_title( '', false );
  7. } elseif ( is_author() ) {
  8. $title = '<span class="vcard">' . get_the_author() . '</span>';
  9. } elseif ( is_year() ) {
  10. $title = get_the_date( _x( 'Y', 'yearly archives date format' ) );
  11. } elseif ( is_month() ) {
  12. $title = get_the_date( _x( 'F Y', 'monthly archives date format' ) );
  13. } elseif ( is_day() ) {
  14. $title = get_the_date( _x( 'F j, Y', 'daily archives date format' ) );
  15. } elseif ( is_tax( 'post_format' ) ) {
  16. if ( is_tax( 'post_format', 'post-format-aside' ) ) {
  17. $title = _x( 'Asides', 'post format archive title' );
  18. } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
  19. $title = _x( 'Galleries', 'post format archive title' );
  20. } elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
  21. $title = _x( 'Images', 'post format archive title' );
  22. } elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
  23. $title = _x( 'Videos', 'post format archive title' );
  24. } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
  25. $title = _x( 'Quotes', 'post format archive title' );
  26. } elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
  27. $title = _x( 'Links', 'post format archive title' );
  28. } elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
  29. $title = _x( 'Statuses', 'post format archive title' );
  30. } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
  31. $title = _x( 'Audio', 'post format archive title' );
  32. } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
  33. $title = _x( 'Chats', 'post format archive title' );
  34. }
  35. } elseif ( is_post_type_archive() ) {
  36. $title = post_type_archive_title( '', false );
  37. } elseif ( is_tax() ) {
  38. $title = single_term_title( '', false );
  39. } else {
  40. $title = __( 'Archives' );
  41. }
  42. return $title;
  43. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement