How to Pass Current Taxonomy Terms into new WP_Query?

Try this: add_action( ‘genesis_loop’, ‘bds_more_projects_query’ ); function bds_more_projects_query() { if ( is_singular( ‘portfolio’ ) ) { $categories = get_the_terms( $post->ID, ‘portfolio_category’ ); $cat_ids = array(); foreach ( $categories as $category ) { $cat_ids[] = $category->term_id; } $args = array( ‘post_type’ => ‘portfolio’, ‘posts_per_page’ => 4, ‘tax_query’ => array( array( ‘taxonomy’ => ‘portfolio_category’, ‘field’ => ‘id’, … Read more

How to add in WP_Query to every 3 posts displayed? [duplicate]

This would work: <?php $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 8, ‘orderby’ => ‘date’, ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { $i=1; echo ‘<ul>’; while ( $loop->have_posts() ) : $loop->the_post(); //wc_get_template_part( ‘content’, ‘product’ ); ?> <li class=”col-md-3″> <div class=”gridproduto”> <a href=”https://wordpress.stackexchange.com/questions/266104/<?php the_permalink(); ?>”> <?php global $post, $product; ?> … Read more

Why does it loop twice?

I agree with Takebo it’s problem with tag. <div class=”col-md-12 postbody “> <a href=”https://wordpress.stackexchange.com/questions/266597/<?php the_permalink(); ?>”><?php the_title(); ?> here is missing </a> `</div> <a class=”cta” href=”https://wordpress.stackexchange.com/questions/266597/<?php the_permalink(); ?>”>DÉCOUVRIR &#8594;</a> </div> </div>`

Show other category posts in single.php

List of post of a category can be show using wp_query like this $paged = get_query_var(‘paged’) ? get_query_var(‘paged’) : 1; $args = array( ‘post_type’ => ‘post’, //Specifying post type ‘posts_per_page’ => 10, //How many posts per page ‘cat’ =>’cat2′, //Specifying post category to show posts ‘paged’ => $paged //For pagingation (if required) ); $loop = … Read more

get wordpress post loop by meta box date

Have you tried passing in the $args variable to query_posts, rather than $guide? query_posts($args); Also, you should be looking to create the custom query using WP_Query class and not the query_posts. See this answer for more details (https://wordpress.stackexchange.com/a/1755) Try the below code: $args = array(‘post_type’ => ‘post’, ‘meta_key’ => ‘meta_date’, ‘meta_value_num’ => , ); $my_query … Read more

Start loop from specific post ID

I’m not sure I understand what you are trying to achive, but I suspect you want to: – show current post in carousel – show all other posts (without post shown before) – single post If thats what you need one more loop – so you can first show your current post, then to show … Read more