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

Merge two queries and remove duplicate

Why not do something like this? $fav_author_list = get_user_option( ‘favorite-authors’, fav_authors_get_user_id() ); $fav_category_list = get_user_option( ‘favorite-categories’, fav_categories_get_user_id() ); if(!empty($fav_author_list) && !empty($fav_category_list)) { $rm_args = array( ‘posts_per_page’ => -1, ‘author__in’=> $fav_author_list, ‘category__in’=> $fav_category_list, ‘post_type’ => ‘post’ ); } elseif(!empty($fav_author_list) && empty($fav_category_list)) { $rm_args = array( ‘posts_per_page’ => -1, ‘author__in’=> $fav_author_list, ‘post_type’ => ‘post’ ); } elseif(empty($fav_author_list) … Read more

query_posts -> get page_id from custom field

You get a custom field by using get_post_meta: <?php $pageID = get_post_meta( get_the_ID(), ‘custom_field_name’, true ); ?> You can then use that for the query you need, but you should not use query_posts, this function overrides the main query and isn’t normally used on themes or plugins, it should be avoided. This can increase page … Read more

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