Guest User

Untitled

a guest
Jul 16th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. <?php
  2. /**
  3. * @param $title
  4. * @return array
  5. */
  6. function archive_titles($title): array
  7. {
  8. global $post;
  9.  
  10. $type = $post->post_type;
  11.  
  12. $types = [
  13. 'custom_post_type' => 'Custom title',
  14. ];
  15.  
  16. if (is_archive() && isset($types[$type])) {
  17. $title['title'] = $types[$type];
  18. }
  19.  
  20. return $title;
  21. }
  22.  
  23. add_filter('document_title_parts', 'archive_titles');
Add Comment
Please, Sign In to add comment