Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #6538

    In this thread:

    http://www.kriesi.at/support/topic/pages-instead-of-posts-in-slider-but-how-about-both

    You suggested (successfully) that to display both pages and posts in the slider to change code to:

    $additional_loop = new WP_Query(array(‘post_type’ => array( ‘post’, ‘page’ ), ‘posts_per_page’ => 5, ‘post__in’ => array(37,50,54,30,32)));

    That works great! Thank you.

    However, can you change the code so that the order is reversed from where it is now. Pages, then posts and not posts then pages? What would be the new code?

    Thank you.

    #54549

    Hey,

    have you tried

    $additional_loop = new WP_Query(array('post_type' => array( 'page', 'post' ), 'posts_per_page' => 5, 'post__in' => array(37,50,54,30,32)));

    Let me know if it works, I didn’t check on it but it only seems logical.

    #54550

    I am a total new and am just taking a stab in the dark but would you just reverse the order in that command?

    Go from …

    $additional_loop = new WP_Query(array(‘post_type’ => array( ‘post’, ‘page’ ), ‘posts_per_page’ => 5, ‘post__in’ => array(37,50,54,30,32)));

    To….

    $additional_loop = new WP_Query(array(‘post_type’ => array( ‘page’, ‘post’ ), ‘posts_per_page’ => 5, ‘post__in’ => array(37,50,54,30,32)));

    #54551

    Yep! Let me know if it works :)

    #54552

    We must have posted at almost the exact same time!

    Now if someone will answer my question I can quit coming to the forums!

    #54553

    .. didn’t it work? I believe I answered this question – your other topics will be replied to shortly :)

    #54554

    I am the originator of this thread, the other person -hideous- was just commenting.

    I tried the second version you suggested of the code, switching the positions of ‘page’ and ‘post’ and that had no effect on the order of display.

    Any other suggestions to solve the problem? Thank you.

    #54555

    As far as I know it’s not possible to affect the query by replacing page/post with post/page, etc. You can try to change the post publishing date to adjust the order.

    #54556

    Thank you. Will have to go to Plan B, whatever that is.

    #54557

    I think the easiest solution is to duplicate the query code – set the first query for pages, the second for posts.

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘A slight adjust (if possible) needed to display posts and pages in slider’ is closed to new replies.