WordPress.org

Support

Support » Plugins and Hacks » Hacks » query_posts in sidebar

query_posts in sidebar

  • 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?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘query_posts in sidebar’ is closed to new replies.