WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Multiple meta_key, sort and condicional] (1 post)

  1. kentverger
    Member
    Posted 2 years ago #

    i have a custom fields to add position in the page, i have 2 meta keys one to know the part of the page where i will print and other to specific the order of the post.

    This is my code:

    $args = array(
       'meta_query' => array(
           array(
              'meta_key' =>'destacados',
              'meta_value' => 'on'
           )
        ),
        'orderby' => 'meta_value_num',
        'category__in' => $category->cat_ID,
        'meta_key' => 'pos'
    );
    $loop = new WP_Query($args);

    This code brings me also the post that have the meta_key pos, but i want only the post that have destacados meta_key, pos meta_key and have the category that I give to the object.

    i have no idea i hope tha you can help me :)

    Thanks for reading :)

Topic Closed

This topic has been closed to new replies.

About this Topic