WordPress Title PHP Snippet


/ Published in: PHP
Save to your folder(s)

Used in my post on how to optimize WordPress, which can be found here: http://www.brettwidmann.com/2010/01/optimizing-your-wordpress-site-pt-2/


Copy this code and paste it in your HTML
  1. <title><?php if (is_home () )
  2. {
  3. bloginfo('name');
  4. }
  5.  
  6. elseif ( is_category() )
  7. {
  8. single_cat_title(); echo ' - ' ;
  9. bloginfo('name');
  10. }
  11.  
  12. elseif (is_single() )
  13. {
  14. single_post_title();
  15. }
  16.  
  17. elseif (is_page() )
  18. {
  19. bloginfo('name');
  20. echo ': ';
  21. single_post_title();
  22. }
  23.  
  24. else
  25. {
  26. wp_title('',true);
  27. } ?></title>

URL: http://www.brettwidmann.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.