WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom sidebar conditionals (3 posts)

  1. stuboo
    Member
    Posted 8 years ago #

    I've read through the conditionals to try to figure out a way to make this happen but so far have had no luck. Here's what I'd like to do.


    if (is_page('12') || is_category('3')){?>
    <h2>Recent Posts</h2>
    <?php
    $posts = get_posts('numberposts=4&category=3');
    foreach($posts as $post) :
    ?>
    <p class="title">"><?php the_title(); ?><?php the_excerpt(); ?>
    <?php endforeach; } ?>

    As it is written, the is_category() tag won't work because this conditional only works "When the archive page for Category 3 is being displayed."

    How can I do this?

  2. stuboo
    Member
    Posted 8 years ago #

    nevermind. in_category() did the trick.

  3. DANG_BLUE
    Member
    Posted 8 years ago #

    My wordpress sidebar thinks is_category() is is_home(), I don't know why.

Topic Closed

This topic has been closed to new replies.

About this Topic