• 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)
  • Have a look at custom fields:

    http://codex.wordpress.org/Using_Custom_Fields

    Thread Starter privendo

    (@privendo)

    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

    (@ss_minnow)

    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.