Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Setup Meta Variables
- global $post;
- $categories = get_the_category($post->ID);
- $post_title = single_post_title('', FALSE);
- $site_title = get_bloginfo('sitetitle');
- $category_title = $categories[0]->cat_name;
- $site_description = get_bloginfo('description');
- $forum_description = "Custom forum description";
- ?>
- <?php
- // Forum Board Meta Tags
- if(get_post_type() == 'forum') {
- if($post_title <> "") {
- $post_title = $post_title;
- } else {
- $post_title = "Custom post title";
- }
- ?>
- <title><?php echo $site_title; ?> - <?php echo $post_title; ?></title>
- <meta name="description" content="<?php echo $site_title; ?> - <?php echo $post_title; ?> - <?php echo $forum_description; ?>" />
- <meta name="keywords" content="<?php echo $site_title; ?>, <?php echo $post_title; ?>, keyword, keyword2, keyword 3" />
- <?php
- // Forum Topic or Reply Meta Tags
- } else if (get_post_type() == 'topic' OR get_post_type() == 'reply') {
- ?>
- <title><?php echo $post_title; ?> - <?php echo $site_title; ?></title>
- <meta name="description" content="<?php echo $post_title; ?> - <?php echo $site_title; ?> - <?php echo $forum_description; ?>" />
- <meta name="keywords" content="<?php echo $post_title; ?>, <?php echo $site_title; ?>, keyword, keyword2, keyword 3" />
- <?php
- // Else, wordpress pages/posts meta tags
- } else {
- // Home page specific meta tags
- if (is_front_page()) {
- ?>
- <title><?php echo $site_title; ?> - Custom homepage title!</title>
- <meta name="description" content="<?php echo $site_title; ?> - <?php echo $site_description; ?>" />
- <meta name="keywords" content="<?php echo $site_title; ?>, keyword, keyword2, keyword 3" />
- <?php
- // Else, posts, pages and categories
- } else {
- ?>
- <title><?php if($post_title <> "") { echo $post_title . " - "; } else { echo $category_title . " - "; } ?><?php bloginfo('sitetitle'); ?></title>
- <meta name="description" content="<?php if($post_title <> "") { echo $post_title . " - "; } else { echo $category_title . " - "; } ?><?php echo $site_description; ?>" />
- <meta name="keywords" content="<?php if($post_title <> "") { echo $post_title . ","; } else { echo $category_title . ","; } ?>, keyword, keyword2, keyword 3" />
- <?php } ?>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment