WordPress Genesis custom taxonomy archive shows 3 repeats of each post

You are using a nested loop in your code. You should only use the foreach loop, and pass the post ID to get_field(). Here’s an example: $terms = get_terms( [ ‘taxonomy’ => ‘collection_categories’, ‘orderby’ => ‘name’, ‘order’ => ‘DESC’ ] ); // Rest of the code here foreach ( $posts as $post ) { //* … Read more

Meta Query with spaces in value?

Try to pass your multi value in array, example ‘meta_query’ => array( array( ‘key’ => ‘some_key’, ‘value’ => array( “value1 with space”, “value2”, “value3”, ), ‘compare’ => ‘IN’ )

ACF page while loop breaks footer while loop

Looks like you need to add ‘option’ to your footer the_sub_field() calls: <p><a href=”https://wordpress.stackexchange.com/questions/307577/<?php the_sub_field(“footer_link’, ‘option’); ?>”><?php the_sub_field(‘footer_link_name’, ‘option’); ?></a></p> var_dump() is used to dump a variable, not a string, so you would need to do something like var_dump($test) for that line to work. You are probably getting errors and warnings in your PHP log … Read more

How can I add multiple ‘tax_query’ arrays via a loop?

OK, I have no idea how and why your code should work… It has nothing in common with correct PHP syntax… But it’s pretty good pseudo-code, so I think I can guess, what you wanted to achieve… $tax_query = array(); if ( have_rows(‘category_taxonomies’) ) { while ( have_rows(‘category_taxonomies’) ) { the_row(); $tax_query[] = array( ‘taxonomy’ … Read more

Loop through custom fields with similar label / common chars in label

You display data in loop, so all item have the same ID div id=”demo”. Add some suffix to make them unique. For example: $lang = substr($field[‘name’], strpos($field[‘name’], “_”); echo ‘<button data-toggle=”collapse” data-target=”#demo-‘. $lang .'”> ….’; echo ‘<div id=”demo-‘. $lang .'” class=”collapse”> …</div>’ Edit Audio doesn’t work inside the collapse panel because key $name never meets … Read more

Show all posts in sidebar in single.php

Initiating new WP_Query($post) shows all posts. Credit to @Latheesh V M Villa Add: $loop_query = new WP_Query($post) Then change loop values like: have_posts() to: $loop_query->have_posts() loop.php <?php $loop_query = new WP_Query($post); if ($loop_query->have_posts()): while ($loop_query->have_posts()) : $loop_query->the_post(); ?> <article class=”loop-template” id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <!– article content here –> </article> <?php endwhile; ?> … Read more