Query all posts and not repeat the same tag

You can try something like this: <?php $tags_array = get_tags(); $news_query = new WP_Query; foreach ( $tags_array as $tags ) : $news_query->query( array( ‘cat’ => $tags->term_id, ‘posts_per_page’ => 1, ‘no_found_rows’ => true, ‘ignore_sticky_posts’ => true, )); ?> <h2><?php echo esc_html( $tags->name ) ?></h2> <?php while ( $news_query->have_posts() ) : $news_query->the_post() ?> <div class=”post”> <?php the_title() … Read more

Ordering terms before displaying posts

You could use tax_query to get only the posts with the term that is currently being looped. $argsPost = [ ‘post_type’ => ‘meal’,//CPT meal ‘posts_per_page’ => -1, ‘meta_key’ => ‘ordre’, ‘orderby’ => ‘meta_value’, // Use the custom post order ‘order’ => ‘ASC’ ‘tax_query’ => array( array( ‘taxonomy’ => ‘cat_meal’, ‘field’ => ‘term_id’, ‘terms’ => $term->term_id, … Read more

How to dynamically build a multiple taxonomy query loop within a post type’s single loop?

As per comment I also see some trouble understanding album and album media essence. You are also mixing up terminology a bit with terms and taxonomies (term is item in taxonomy). So I am going to focus on your summary and leave to you how to put parts together: multiple taxonomy query – taxonomy queries … Read more

Function to show random posts from a category

cleaned up syntax errors: <?php function titoloslide() { query_posts(array( ‘orderby’ => ‘rand’, ‘category_name’ => ‘testimonianze’, ‘posts_per_page’ => 1 )); if (have_posts()) : while (have_posts()) : the_post(); ?> <div class=”testimonianzefurgonihome”><a href=”#” title=”Testimonianze noleggio furgoni KobalRent”><?php the_excerpt(); ?></a></div> <?php endwhile; endif; wp_reset_query(); } ?>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)