How Can I Always Display A Particular Post First Using WP_Query?
Loop over the $cpackages results twice, and rewind_posts() in between. first time only output when the id matches the current post id, then skip that id the second time through.
Loop over the $cpackages results twice, and rewind_posts() in between. first time only output when the id matches the current post id, then skip that id the second time through.
Make the user query when the job is submitted and put all matching subscribers in a queue. At the end of the day run through the queue once and send the mails.
The meta query is converted by _get_meta_sql(). You can check the output by hooking into get_meta_sql. Dump that value and see what it gives.
You seem to be generating broken markup by mixing stuff in and out of list item (<li></li>) tags. Try validating resulting markup and fix any errors produced.
The posts query is not recursive by nature. And I don’t think that post_parent accepts multiple IDs, so you will likely need to loop and run this for multiple pages or play with query filters to do this in less requests (if performance becomes an issue).
POST does not have parents, but categories. Only PAGE can have parent. So, the question is, what do you want to get? In case of getting POSTS from different categories, just use get_posts and add multiple categories. As for pages, just use get_page_children.
Sorry I deleted my comment because I found the issue. You need to do an html entity decode on query variable. Use the code below. function hey_query_shortcode( $atts ) { extract( shortcode_atts( array( ‘query’ => ”, ‘style’ => ” ), $atts ) ); $query = html_entity_decode( $query ); ob_start(); $the_query = new WP_Query( $query ); … Read more
Ajax handler runs in completely separate instance of WordPress, it has no access to global variable from your pages and such. Basically there is nothing to rewind here, you need to pass those environment variables in request and query for comments from scratch.
did you try this? $custom_query_args = array( ‘post_type’ => ‘casestudy’, ‘connected’ => $post->ID ); $the_query = new WP_Query(); $the_query->query($custom_query_args);
Assuming that you are on a taxonomy or term page then you can simply use: //get current term $term_slug = get_query_var( ‘term’ ); //get current taxonomy $taxonomyName = get_query_var( ‘taxonomy’ ); $loop = new WP_Query( array( ‘post_type’ => ‘work’, ‘posts_per_page’ => 10, ‘orderby’ => ‘ASC’, $taxonomyName => $term_slug); while ( $loop->have_posts() ) : $loop->the_post();