Why am I getting no results of a query placed after another query?
Why am I getting no results of a query placed after another query?
Why am I getting no results of a query placed after another query?
Note that is_category() accepts a category ID, name, slug, or array of such, so you could actually simply use is_category( array( ‘Lumber’, ‘Domestic Hardwoods’ ) ) instead of having to call is_category() twice. But as for what you asked, is_category() does not support that, however, what you are trying to do can be achieved like … Read more
I removed the following line and fixed. <span><?php the_field(‘repeater_related_items’); ?></span>
I have sorted this issue i was tested this code on our test server and i saw error on post detail page the error was Fatal error: Call to undefined function short_title() after seen this i have remove the function code short_title(); from my custom.php and replace with the_title(); to display tittle.And i have check … Read more
What if you save each query in a variable ? <ul> <?php $query1 = query_posts( array( ‘posts_per_page’ => -1, ‘post_type’ => array(‘specialties’) )); if($query1->have_posts()): while($query1->have_posts()): $query1->the_post(); ?> <li> <!– title from post type specialties –> <p><?php the_title(); ?></p> <ul> <?php $query2 = query_posts( array( ‘posts_per_page’ => -1, ‘post_type’ => array(‘team’) )); if($query2->have_posts()): while($query2->have_posts()): $query2->the_post(); ?> … Read more
do you have the current page number in your $query array? for example: $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $query = array( ‘paged’ => $paged );
As noted by @s_ha_dum, I had some sticky posts. I had to use the ‘ignore_sticky_posts’ => true argument inside the WP_Query.
Using meta_key and meta_value are good for filtering a single custom field. But for comparing two fields, you need to construct a meta_query with your two key/values and a compare operator. See this answer which shows the various things you need to do to achieve this. https://wordpress.stackexchange.com/a/227869/111022
Okay, I’ve got it sorted. I found a post on here with something similar; WordPress wasn’t resetting back into the main loop. So my code is now: /* Show roles metabox */ function show_roles_metabox() { global $post; $tempPost = $post; wp_nonce_field(basename(__FILE__), ‘role_nonce’); $pro_areas = array( ‘One’, ‘Two’, ‘Three’ ); $args = array( ‘post_type’ => ‘proarea’, … Read more
Why does the theme insert the comments section if I don’t reset my custom WP_Query?