Custom Post type loop with ACF not displaying properly
Try and remove the_post_thumbnail function from the img tag. On its own the_post_thumbnail prints out the img tag so there seems to be two img tag ending in your script.
Try and remove the_post_thumbnail function from the img tag. On its own the_post_thumbnail prints out the img tag so there seems to be two img tag ending in your script.
Each of your code blocks will overwrite the previous, you need to add to the array rather than replace it: $args[‘tax_query’][] = array( ‘taxonomy’ => ‘region’, ‘field’ => ‘id’, ‘terms’ => $_POST[‘region_filter’] ); relation is AND by default, so you can just omit it, but if you wanted to explicitly set it: $args[‘tax_query’][‘relation’] = ‘AND’;
Looking over the code I am seeing a couple of things that may be causing issues. The single line comment ‘Repeat the process…’ is not being closed properly. As you are creating multiple custom loops, it’s a good idea to reset the loops. You can do this by calling one of the below functions after … Read more
The issue turned out to be custom post types. Even though a custom post type produces posts, WP_Query() doesn’t select them unless specifically coded to do so with ‘post_type’ => ‘slug’, in the query arguments.
This is possible with native query parameters like this: $posts = get_posts([ ‘post__in’ => [2,5,3,1,4,6], ‘orderby => ‘post__in’, ]); This combination will instruct WP to fetch specific posts by ID and order them in the specific way that you supplied IDs.
You can try using cat or category__in (for array of categories) instead of category-name and assign an ID to it: $args = array( ‘posts_per_page’ => 6, ‘post_type’ => ‘albums’, ‘cat’ => 4, ); I also would use single quotation ‘ instead of double quotation ” while setting a value. You are also missing quotations around … Read more
This creates the multidimensional array in advance and then assigns it to options. The multidimensional array is created by assigning an array to each element of the main array. I have reused the $feat_pages_terms variable, but you can also create a separate variable using array() and assign array elements to that, I am including those … Read more
Probably the date format should be different – like: $date_debut = date(‘Y-m-d’,$date_debut); $date_fin = date(‘Y-m-d’,$date_fin); I haven’t tested this but the doc says: The ‘type’ DATE works with the ‘compare’ value BETWEEN only if the date is stored at the format YYYY-MM-DD and tested with this format.
Depending what you want to achieve, the most simple way taken from WordPress documentation looks like below. Displays posts tagged with “bob”, under “people” custom taxonomy: $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘people’, ‘field’ => ‘slug’, ‘terms’ => ‘bob’, ), ), ); $query = new WP_Query( $args ); Check … Read more
I think you need first to sort the genre terms in the other query: $genres = get_terms( ‘genre’, ‘orderby=term_id’ ); And then on the posts query for each genre (like Chip Bennet’s approach): $member_group_query = new WP_Query( array( ‘post_type’ => ‘member’, ‘orderby’ => ‘name’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘member_group’, ‘field’ => ‘slug’, ‘terms’ … Read more