WordPress.org

Ready to get started?Download WordPress

Forums

query_posts in sidebar (3 posts)

  1. webguy262
    Member
    Posted 3 years ago #

    Trying to get the sidebar to display certain posts based on page / parent id.

    The 'if' part works, but the 'else' fails to display anything. I want the 'else' to return the last three posts regardless of category.

    <?php
    global $post;
    if (125 == $post->post_parent || 125 == $post->ID || 705 == $post->post_parent || 705 == $post->ID) {
    query_posts( array( 'category__in' => array(5, 9, 155), 'posts_per_page' => 3 ) );
    } else {
    query_posts( 'posts_per_page=3' );
    }
    ?>

    What am I missing?

  2. Tara
    Member
    Posted 3 years ago #

    review this codex guide and see if it helps: http://codex.wordpress.org/Function_Reference/query_posts

  3. FlyerUA
    Member
    Posted 3 years ago #

    sorry, posted wrong thing

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.