WP_Query() not working as expected

Ah, nevermind. Found it. I’m using another plugin (EDD Hide Download) which hides certain downloads and does that by hooking into the pre_get_posts action, which is triggered in WP_Query. The download in question was marked as hidden, that’s why WP_Query didn’t return it. To resolve this, I did the following. I added an action which … Read more

WooCommerce sort by SKU

To use with woocommerce plugin and theme already css and code. $args = array( ‘post_type’ => ‘product’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘_sku’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘DESC’, ); query_posts( $args ); if( have_posts() ) : while (have_posts()): the_post(); wc_get_template_part( ‘content’, ‘product’ ); endwhile; endif; wp_reset_query();

wp_query – Exclude the first thumbnail from lazy loading on archives

Filters must always return a value. If you do not return a value, it’s the same as returning an empty value, null, etc. This is always the first parameter, or a modified/replacement version of it. So this: add_filter( ‘wp_get_attachment_image_attributes’, function( $attrs ) { if ( !is_single() && !is_page() && is_front_page() && is_archive() && is_search() ) … Read more

Using ACF values in nested WP queries for CPT with date values in the past

Your current meta query embodies the logic IF event_end IN range OR event_start IN range You need to account for the conditions of event_end‘s presence separately: IF event_end IN range OR ( event_end NOT EXISTS AND event_start IN range ) Immediately adjacent nested clauses with the same AND/OR relation can be combined, which might make … Read more