Tag Info

New answers tagged

1

You don't get any ordering, because you are making multiple get_posts() calls and only retrieve a single post in each of them. You cannot order a single post. :) You need to get rid of outermost loop and just pass a set of IDs (that would be your $instance['data']) to retrieve via single get_posts() call.


0

Like I said, in your custom scenario, after getting the results, here is your how you can do it: $data_attach = get_posts($args); $title_array = array(); foreach ($data_attach as $data) : $title_array[] = $data->post_title; endforeach; sort($title_array); foreach ...


0

You are mixing up an older meta syntax with the newer one. I'd suggest you clean that up for readability and for potential compatibility in the future. (WordPress does seem to parse the mixed query correctly though) $args = array( 'posts_per_page' => -1, 'post_type' => MDJM_EVENT_POSTS, 'post_status' => 'mdjm-approved', ...


0

So digging around a little i couldn't find a solution where the WP_Query wasn't used, so i just stuck with the query method, Using WP_Query this snippet will display the latest post that is published by the user that is logged in. $user_id = get_current_user_id(); $args=array( 'post_type' => 'POSTTYPE', 'post_status' => 'published', ...


0

I have a custom template and I struggled hours to show the pagination component. here what's worked for me. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'posts_per_page' => 3, 'orderby' => 'menu_order', 'order'=> 'ASC', 'paged'=>$paged, 'post_type' => 'projects' ); $projects = new ...



Top 50 recent answers are included