wp query remove posts from query then update max pages and posts found
wp query remove posts from query then update max pages and posts found
wp query remove posts from query then update max pages and posts found
Hi @eeyore: Without being able to see the full context of your theme page I think you have at least two issues. You need to use $wp_query instead of $my_query if you want previous_posts_link() and next_posts_link() to work since they assume $wp_query. What @Jan Fabry mentioned; you need to capture the pagination yourself and pass … Read more
This doesn’t seems to be natively possible, even with upcoming improvements in WP 3.1. […] That’s not what taxonomies are for. Taxonomies are for grouping, not for ordering by. If you want to order by something, it has to be something in the post itself, not a term in a taxo. Otto For this kind … Read more
The only thing I see as even close to syntactically questionable is that showposts could be replaced with posts_per_page.
I don’t really understand what you’re trying to do, so here goes nothing: There are a lot of hooks within WP_Query. Most of them pass the current instance as one of the arguments. So, here’s how you could check for a “custom query”: function check_wp_query( $posts, $wp_query ) { if ( $wp_query->get(‘my_arg’) ) { // … Read more
Here’s the code that finally worked for me: <?php global $events_meta_termine; $today = getdate(); $my_query = new WP_Query(‘post_type=events&posts_per_page=-1&monthnum=’.$today[“mon”]); $events=array(); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; $meta = get_post_meta(get_the_ID(), $events_meta_termine->get_the_id(), TRUE); foreach ($meta[‘termin_group’] as $termin) { $event=array(); $event[‘title’]=get_the_title(); $event[‘date’]=$termin[‘termin_date’]; $event[‘time’]=$termin[‘termin_time’]; $event[‘location’]=$termin[‘termin_location’]; $events[]=$event; } endwhile; wp_reset_query(); $i=0; usort($events, “cmp”); function cmp($a, $b){ return strcmp($a[‘date’],$b[‘date’]); } ?> … Read more
This looks like a query generated as part of the search facility within WordPress. For example, a visitor has been to your site and typed the word ‘true’ into your search box. If you have a large number of posts/pages/etc in your WordPress installation, then the only way you could optimise this query is to … Read more
Child posts are related to their parents (through the “post_parent” field), and not vice versa. So you would have to query your child post type first, then get the parents of all the results. // obviously these variable names and key names might not apply, // change them as necessary $performances = get_posts( array( ‘meta_key’ … Read more
Just run 2 queries, the first to pull just the new-videos and the 2nd to pull everything else but the new-videos. Probably just use WP_Query for the first one to get the new-videos and then alter the loop query for the 2nd one to exclude new-videos.
When should you use WP_Query vs query_posts() vs get_posts()?