Mar
24

Excerpt function with conditional tags:

Excerpt function with conditional tags:

I hope you have read the post by Shane about the excerpt in wordpress. That method can be used to bypass the excerpt in the Loop. However, excerpt can be used with some conditional tags in your Loop.

For example, you want excerpt to word only for categories and achieves. Then replaces the_content() tag with the_excerpt() when on archive (tested by is_archive()) or category (is_category()) pages.

<?php if(is_category() || is_archive()) {
the_excerpt();
} else {
the_content();
} ?>

Popularity: 7%

Related posts:
  1. Conditional Tags In WordPress Hi, These are the Conditional Tags that can be used...
  2. How To Display Post Excerpt In WordPress Hi, As a wordpress user you may need to show...
  3. How To Split Posts with the More Tags? Wondering how to display first few (selected) words in the...
  4. List Of Post Tags in WordPress Blog Hi, These are the Post tags which can be used...
  5. Code To Create Two Tiered Conditional Navigation In WordPress? Hi, To Display Two Tiered Conditional Navingation In wordpress need...

Leave a Reply

You must be logged in to post a comment.