Forums

query (2 posts)

  1. Morten_a
    Member
    Posted 1 year ago #

    Hi,

    I have a query that look like this:
    $services_list = new WP_Query();
    $services_list->query('post_type=page&showposts=3&post_parent='.$services_pid. '&orderby=date');

    It shows 3 pages by date.

    I want to pick the 3 pages, and im trying to use:
    &orderby=ID

    But i cant make it work.
    Can someone tell me how this code should look like?

    Thanks in advance

    Morten.

  2. vtxyzzy
    Member
    Posted 1 year ago #

    If you want to pick 3 pages by page ID (23,52,19 for example), you can use this:

    $services_list = new WP_Query();
    $args = array(
       'post_type' => 'page',
       'showposts' => 3,
       'post_parent' => $services_pid,
       'orderby' => 'date',
       'post__in' => array(23,52,19)
    );
    $services_list->query($args);

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags