WordPress.org

Forums

WP_query (1 post)

  1. machacek76
    Member
    Posted 1 year ago #

    hi all

    i need to do wp_query order by custom fields and date

    custom fileds publish date
    (val)
    1 2013-10-23
    1 2013-09-23
    1 2013-09-20
    0 2013-10-23
    0 2013-10-20
    0 2013-10-18
    0 2013-09-12

    this query:

    $args = array(
    'cat' => 5,
    'orderby' => 'meta_value',
    'meta_key' => 'free',
    'order' => 'DESC',
    'meta_query' => array(
    array(
    'orderby' => 'date',
    'order' => 'ASC'
    )
    ),
    'posts_per_page' => 5
    );

    sorting:
    custom fileds publish date
    (val)
    1 2013-10-23
    1 2013-09-23
    1 2013-09-20
    0 2013-09-12
    0 2013-10-18
    0 2013-10-20
    0 2013-10-23

Topic Closed

This topic has been closed to new replies.

About this Topic