What is the best way to offset previous posts on the same page?
What is the best way to offset previous posts on the same page?
What is the best way to offset previous posts on the same page?
This is likely not the “ideal” approach, but this works for me, and now I can move on to other things. If someone has a better option, I’d love to hear it, thank you. $base_args = [ ‘post_type’ => ‘crowdfunding’, ‘numberposts’ => 30, ‘posts_per_page’ => ’50’, ]; $meta_query = array( array( ‘key’ => ‘campaign_start_date’, ‘compare’ … Read more
Applying a custom query for the AJAX “us_ajax_grid” function (from WPBakery)
Just a couple of minor formatting changes: an extra nested array that can be deleted, and the incorrect ‘value’ when using the ‘=’ compare operator, and an unnecessary ‘relation’ parameter. $args[‘meta_query’] = array( // array( <- an extra array you don’t need ‘relation’ => ‘OR’, array( ‘relation’ => ‘AND’, array( ‘key’ => ‘dummy’, ‘value’ => … Read more
Problems with relation OR in the meta query in WP_Query
Products are displayed only in the admin area
How to short circuit a wordpress query that is not related to posts?
You are right to say: Never use query_posts anymore pre_get_posts pre_get_posts is a filter, for altering any query. It is most often used to alter only the ‘main query’: add_action(‘pre_get_posts’,’wpse50761_alter_query’); function wpse50761_alter_query($query){ if( $query->is_main_query() ){ //Do something to main query } } (I would also check that is_admin() returns false – though this may be … Read more
WP_Query filtering in ACF field containing dates
When you set WordPress up with: The set-up Custom Permalink Structure: /blog/%postname%/ Category base: blog Generated rewrite rules WordPress generates these rewrite rules: blog/([^/]+)(?:/([0-9]+))?/?$ => index.php?name=$matches[1]&page=$matches[2] blog/(.+?)/?$ => index.php?category_name=$matches[1] Rewrite rule position in the rewrite_rules_array Your post rewrite rule (#1) is positioned earlier (therefore higher priority) than the category rewrite rule (#2) in your rewrite_rules_array. … Read more