Change the_content to excerpt on comment pages (Wordpress)


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

This helps to avoid the "duplicated content" indexation by google on wordpress comment pages by changing the post content to the_excerpt ONLY in comment pages.


Copy this code and paste it in your HTML
  1. <?php if ( function_exists('get_query_var') ) {
  2. $cpage = intval(get_query_var('cpage'));
  3. if ( empty( $cpage ) ) : ?>
  4. <?php the_content('Continúa Leyendo'); ?>
  5. <?php else: ?>
  6. <?php the_excerpt(); ?>
  7. <?php endif; ?>
  8. <?php }; ?>

URL: http://www.lagzero.net

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.