posts_per_page displays only 2 posts instead of 4 posts
posts_per_page displays only 2 posts instead of 4 posts
posts_per_page displays only 2 posts instead of 4 posts
Meta query ignores multiple values of the key
I think is as simple as using Timber’s Timber::get_posts() instead of the WP_Query class: $context[‘testimonials’] = Timber::get_posts( [‘post_type’ => ‘what_our_clients_say’, ‘posts_per_page’ => 2] ); Timber::render(‘whatever.twig, $context); … from there you can loop through the testimonials and access ACF values via meta: {% for post in testimonials %} <h1>{{ post.attribution }} says:</h1> {# more here #} … Read more
What you’re trying to do — using the OR relation with the tax_query and meta_query parameters, i.e. to have a <tax queries> OR <meta queries> instead of <tax queries> AND <meta queries> command in SQL, unfortunately (without custom and possibly complex queries) is not possible in WP_Query for now, therefore that ‘relation’ => ‘OR’ in … Read more
SQL to join u3g_users & u3g_meta_value with repeating data
Replace $args = array( ‘post_type’ => array(‘product’, ‘product_variation’), ‘post_status’ => ‘publish’, ‘posts_per_page’ => get_option(‘posts_per_page’), ‘paged’ => $paged, ‘tax_query’ => $tax_query, ‘orderby’ => ‘price’, ‘order’ => ‘asc’, ); New code $orderby = $_GET[‘orderby’] ?? ”; $args = array( ‘post_type’ => array(‘product’, ‘product_variation’), ‘post_status’ => ‘publish’, ‘posts_per_page’ => get_option(‘posts_per_page’), ‘paged’ => $paged, ‘tax_query’ => $tax_query ); if … Read more
WordPress Query for CPT that only shows posts within radius of current user’s geolocation
There are ways to loop through all the sites in a multisite, then do a “WP Loop” on each sub-site. It can get a bit complex, but it can be done. I did some research on this, and found some code fragments that would do it, but no full-on solution. So I wrote my own … Read more
I found a problem. I had to change this: $args = array( ‘cat’ => $category->name, ‘posts_per_page’ => 3,); for this: $args = array( ‘category_name’ => $category->name, ‘posts_per_page’ => 3,); In first code I was passing category name which is string to argument expecting ID of category. Here is Codex reference where I found solution: category_name … Read more
Try $PostID = get_the_ID(); the_field(‘text_field’, $PostID);