WP_Query inside foreach loop returning same value for all options when filtered using ajax

If anyone is interested in how to achieve the result for the question I posted, I managed to work it out! As the correct results we’re being displayed, but for each iteration of the foreach loop rather than the specific day, I managed to get the results to display/hide by using if (is_object_in_term($class->ID, ‘calendar-day’, ‘monday’) … Read more

Display a specific category of products in shop page and disable code for specific actions

This seems to be normal behavior since your filter will apply to any query made on post type archive “product”. You might be able to deactivate the filter for search query by adding the is_search condition to your filter so your function would look like so: add_action(‘pre_get_posts’,’shop_filter_cat’); function shop_filter_cat($query) { if (!is_admin() && is_post_type_archive( ‘product’ … Read more

How to display user order by role

i dont know how to achieve this in query arg. This is because it cannot be done using just arguments. No option for role is listed in the order/orderby parameter docs. There is no option to sort by user role in WordPress. Instead, you’re going to have to query for all gold role users, grab … Read more

add active class based on permalink and url

For the left side you could do this, <?php $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 10, ‘paged’ => get_query_var(‘paged’) ? get_query_var(‘paged’) : 1, ); $loop = new WP_Query( $args ); // add custom function before loop, so you can apply excerpt filter only to this case do_action(‘my_custom_pre_loop_action’); // is url parameter set, if … Read more

category query for pages not working

I just re created the category. Deleted the old category and created a new category with the same name, and now it`s ok. The pages were imported with the native WordPress import-export plugin, from another wp installation, with the category as well (the category was automatically created when I imported the pages), maybe something went … Read more