Title: conditional excerpt / content
Last modified: August 19, 2016

---

# conditional excerpt / content

 *  [privendo](https://wordpress.org/support/users/privendo/)
 * (@privendo)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/conditional-excerpt-content/)
 * some of my posts have youtube in it.
 * I need to show a list of posts like this:
 * if the post has youtube in it – show content otherwise show excerpt
 * How should I do that?
 * Thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/conditional-excerpt-content/#post-1135972)
 * Have a look at custom fields:
 * [http://codex.wordpress.org/Using_Custom_Fields](http://codex.wordpress.org/Using_Custom_Fields)
 *  Thread Starter [privendo](https://wordpress.org/support/users/privendo/)
 * (@privendo)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/conditional-excerpt-content/#post-1136122)
 * it is not a custom field usage
 * I want to query the post’s html, find out if there’s a youtube in it.
    if ther’e
   is I want to show post_content otherwise to show post_excerpt
 *  [Jonas Grumby](https://wordpress.org/support/users/ss_minnow/)
 * (@ss_minnow)
 * [16 years ago](https://wordpress.org/support/topic/conditional-excerpt-content/#post-1136274)
 * If you put all of your posts that have YouTube videos into one category you could
   do it like this;
 *     ```
       <div class="entry">
       <?php if (is_category('your-category')) { ?>
       <?php the_content('Read the rest of this entry &raquo;'); ?>
       <?php } else { ?>
       <?php the_excerpt('Read the rest of this entry &raquo;'); ?>
       <?php } ?>
       </div>
       ```
   
 * As Esmi said you can also use a custom field and query for that value with Conditional
   Tags.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘conditional excerpt / content’ is closed to new replies.

## Tags

 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [Jonas Grumby](https://wordpress.org/support/users/ss_minnow/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/conditional-excerpt-content/#post-1136274)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
