• Hello,

    i have a problem i cant solve. I created custom post type, i have few posts there and some custom fields in those posts.

    On a site im making kind of schedule list. Basically i find out which day is today and print out this+6 days under each i call 2 queries which should display posts scheduled for that day. This works fine. In those posts i have custom fields called “repeat” which should put posts into ie. Monday even if its not published on monday.

    So there is 1 query for showing posts under each day by publish date and 2 query for showing posts under each day by matching “repeat” custom field.

    I need to somehow put these two queries or args into one to make it ordered by publish hour and not to have duplicity posts under one day.

    here is code for those two queries:

    $args=Array(
    'post_type'=>'Program',
    'orderby'=>'published',
    'order'=>'ASC',
    'posts_per_page'=>-1,
    'post_status'=>'any',
    'year'=>$day[year],
    'monthnum'=>$day[mon],
    'day'=>$day[mday],
    );
    $args2=Array(
    'post_type'=>'Program',
    'orderby'=>'published',
    'order'=>'ASC',
    'posts_per_page'=>-1,
    'post_status'=>'any',
    'meta_key'=>'repeat',
    'meta_value'=>$day[wday],
    );
    
    $my_query=new WP_Query($args);
    $my_query2=new WP_Query($args2);

    pls help..

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to combine two loops into one?’ is closed to new replies.