Multiple loops without repeating content

As explained in Codex post__not_in (array) – use post ids. Specify post NOT to retrieve. post__not_in argument have to be passed as array. Change your query to: $the_query = new WP_Query( array( ‘category__in’ => $project_category, ‘posts_per_page’ => -1, ‘post__not_in’ => array( $postid ), ) ); And it should work.

WP Query to Get Array of Slugs

Just run a normal tax_query and set the field parameter to slug in the query. I assume that you already have a way getting the array of slugs (Requires PHP5.4+) $args = [ ‘post_type’ => ‘product’, ‘posts_per_page’ => 12, ‘tax_query’ => [ [ ‘taxonomy’ => ‘TAXONOMY_NAME’, ‘field’ => ‘slug’, ‘terms’ => [‘something’, ‘something-again’, ‘something-else’], ] … Read more

Query custom post type with tags

Have you tried wp_get_post_terms() Example usage: $term_lists = wp_get_post_terms($post_id, ‘product_tag’, array(“fields” => “names”)); I modified your code and got this to work on my site: <ul id=”relatedlist”> <?php $tags = wp_get_post_terms($post_id, ‘product_tag’); if ( $tags ) { $tag_ids = array(); foreach ( $tags as $individual_tag ) array_push($tag_ids,$individual_tag->term_id); $args = array( ‘post_type’ => ‘product’, ‘tax_query’ => … Read more

wp_query with cat not working

From what u have written so far it seems menu_categorie is the custom taxonomy. Make sure it is this only. I get a feeling that you have misses “s” from the end of menu_categorie Anyways The argument ‘cat’ => $id you were using is used for default taxonomy i.e category. But in your case you … Read more

Get Posts that are in the current month or later

You can use meta_query, if you date information is saved in custom field. Like this: $args = array( ‘post_type’ => $custom_post_type, ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘event_date_and_time’, ‘value’ => current_time(‘Ymd’), ‘compare’ => ‘>=’ ) ), ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ ); This code suppose you date is saved in YYYYMMDD … Read more

paging in WP_Query on static page

i have edited your code a bit. And i think it should work.You need to pass parameters to previous_posts_link and next_posts_link. So try the following code <section id=”blogposts” class=”content-block content-3-5 blogposts”> <div class=”row”> <!– Feature Box 1 –> <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $blogposts_args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, … Read more

From where is archive.php getting its posts?

The main query is set up by WP class (curiously little known, since there is rarely reason to mess with it). It happens in between WP core finishing load and proceeding to load template, in wp-blog-header.php. Note that some nuances of implementation: WP class works on a global, set up earlier in wp-settings.php the global … Read more

How to Filter Posts by Custom Fields?

Since you have not provided any code, below code snippet assumes a ‘property’ as post type and price as meta field. I think the code will provide you some direction and you can take it from there. Feel free to make changes as needed: $args = array(‘post_type’ => ‘property’, ‘meta_key’ => ‘price’, ‘orderby’ => ‘meta_value’, … Read more