Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter David Radovanovic

    (@dpaule)

    In other words, if I could achieve the following via Post Query Vars: post_type=event&orderby=event_start_date&order=DESC

    Hi,

    take a look at this page : http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

    under ” ‘orderby’ with ‘meta_value’ and custom post type ” you’ve got an exemple of a meta query thar you could add to your query vars,

    in your case it should be a thing like this instead i think :

    $args = array(
    ‘post_type’ => ‘event’,
    ‘meta_key’ => ‘event_start_date’,
    ‘orderby’ => ‘meta_value’,
    ‘order’ => ‘DESC’,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘event_start_date’,
    ‘compare’ => ‘LIKE’,
    )
    )
    );
    $query = new WP_Query($args);

    Thread Starter David Radovanovic

    (@dpaule)

    reghyz, thanks for the reply. Will I have to unhook the rotator function via: `remove_filter(‘wp_rotator_featured_cell_markup’,’wp_rotator_featured_cell_m arkup’);
    add_filter(‘wp_rotator_featured_cell_markup’,’be_wp_rotator_featured_cell_m arkup’); `

    Thread Starter David Radovanovic

    (@dpaule)

    This seems to have worked:

    post_type=event&orderby=meta_value&meta_key=event_start_date

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘order by custom post meta?’ is closed to new replies.