Advertisement
Guest User

meta tags for custom post types wordpress

a guest
Mar 31st, 2011
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.28 KB | None | 0 0
  1. <?php if ( 'project' == get_post_type() ) { //http://codex.wordpress.org/Conditional_Tags#A_Post_Type ?>
  2.     <title><?php _e( 'Portfolio - Project ', 'sl50' ); ?><?php echo get_the_title($post->ID); ?> | Senlin Online</title>
  3.     <meta name="description" content="<?php // source: http://www.michelem.org/2008/07/11/wordpress-dynamic-meta-description-and-keywords-howto/
  4.     $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", get_the_excerpt());
  5.     echo apply_filters('the_excerpt_rss', $out_excerpt); ?>" />
  6.     <meta name="keywords" content="<?php // get tags outside loop - http://wordpress.org/support/topic/get-tags-outside-the-loop?replies=5#post-905618
  7.        global $post;
  8.        foreach(get_the_tags($post->ID) as $tag) {
  9.           echo $tag->name . ', ';
  10.        }
  11.     ?>" />
  12. <?php } else { ?>
  13.     <title><?php wp_title(''); // original TwentyTen code
  14.  
  15.         // Add the blog name.
  16.         //bloginfo( 'name' );
  17.  
  18.         // Add the blog description for the home/front page.
  19.         $site_description = get_bloginfo( 'description', 'display' );
  20.         if ( $site_description && ( is_home() || is_front_page() ) )
  21.             echo " | $site_description";
  22.  
  23.         // Add a page number if necessary:
  24.         if ( $paged >= 2 || $page >= 2 )
  25.             echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
  26.  
  27.         ?></title>
  28. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement