Query by more than one menu_order value

Question

I’m trying to write a query to get certain posts based on their menu order value. What I specifically want is to get the two previous posts and the next two posts.

So $more_than_one_menu_order_value = “4,5,7,8” or $more_than_one_menu_order_value = array(4,5,6,7) (the current post being 5 for example). But I don’t think ‘menu_order’ takes multiple values, so that’s where I’m getting stuck. Here is my query:

                  $args = array(
                    'post_type' => 'portfolio',
                    'orderby'   => 'menu_order',
                    'order'     => 'ASC',
                    'menu_order' => $more_than_one_menu_order_value
                  );
                  $my_query = new WP_Query($args);

                  while ($my_query->have_posts())
                      {
                          $my_query->the_post();
                          the_title();
                      }

Anyone got any ideas??

Thanks

0
, daveyb 5 months 0 Answers 65 views 0

Leave an answer