Guest User

Untitled

a guest
Jul 17th, 2012
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.24 KB | None | 0 0
  1. <?php
  2.     // Setup Meta Variables
  3.     global $post;
  4.     $categories = get_the_category($post->ID);
  5.     $post_title = single_post_title('', FALSE);
  6.     $site_title = get_bloginfo('sitetitle');
  7.     $category_title = $categories[0]->cat_name;
  8.     $site_description = get_bloginfo('description');
  9.     $forum_description = "Custom forum description";
  10. ?>
  11.  
  12. <?php
  13.     // Forum Board Meta Tags
  14.     if(get_post_type() == 'forum') {
  15.         if($post_title <> "") {
  16.             $post_title = $post_title;
  17.         }  else {
  18.             $post_title = "Custom post title";
  19.         }
  20. ?>
  21.         <title><?php echo $site_title; ?> - <?php echo $post_title; ?></title>
  22.         <meta name="description" content="<?php echo $site_title; ?> - <?php echo $post_title; ?> - <?php echo $forum_description; ?>" />
  23.         <meta name="keywords" content="<?php echo $site_title; ?>, <?php echo $post_title; ?>, keyword, keyword2, keyword 3" />
  24. <?php
  25.     // Forum Topic or Reply Meta Tags
  26.     } else if (get_post_type() == 'topic' OR get_post_type() == 'reply') {
  27. ?>
  28.         <title><?php echo $post_title; ?> - <?php echo $site_title; ?></title>
  29.         <meta name="description" content="<?php echo $post_title; ?> - <?php echo $site_title; ?> - <?php echo $forum_description; ?>" />
  30.         <meta name="keywords" content="<?php echo $post_title; ?>, <?php echo $site_title; ?>, keyword, keyword2, keyword 3" />
  31. <?php
  32.     // Else, wordpress pages/posts meta tags
  33.     } else {
  34.         // Home page specific meta tags
  35.         if (is_front_page()) {
  36. ?>
  37.             <title><?php echo $site_title; ?> - Custom homepage title!</title>
  38.             <meta name="description" content="<?php echo $site_title; ?> - <?php echo $site_description; ?>" />
  39.             <meta name="keywords" content="<?php echo $site_title; ?>, keyword, keyword2, keyword 3" />
  40.     <?php
  41.         // Else, posts, pages and categories
  42.         } else {
  43.     ?>
  44.             <title><?php if($post_title <> "") { echo $post_title . " - "; } else { echo $category_title . " - "; } ?><?php bloginfo('sitetitle'); ?></title>
  45.             <meta name="description" content="<?php if($post_title <> "") { echo $post_title . " - "; } else { echo $category_title . " - "; } ?><?php echo $site_description; ?>" />
  46.             <meta name="keywords" content="<?php if($post_title <> "") { echo $post_title . ","; } else { echo $category_title . ","; } ?>, keyword, keyword2, keyword 3" />
  47.     <?php } ?>
  48. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment