Querying a query

// store the IDs of the posts we’ve already displayed to prevent duplicates $used_ids = array(); $highlights_posts = request_highlights($slides_id); foreach( $highlights_posts as $post ) { setup_postdata($post); // check if we’ve already done this post if(in_array($post->ID,$used_ids)){ // skip to the next one continue; } // we haven’t done this post before, add it’s ID to the … Read more

Exclude categories from postquery

You have missed a & before showposts in the query. Also showposts is depracated. Try using posts_per_page instead. <?php $gallery = get_cat_id(‘gallery’); $shirts = get_cat_id(‘shirts’); $hoodies = get_cat_id(‘hoodies’); $excluded_cats=”-“.$gallery.’,-‘.$shirts.’,-‘.$hoodies; $limit = 5; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; query_posts( ‘cat=” . $excluded_cats . “&posts_per_page=” . $limit . “&paged=’ . $paged ); $wp_query->is_category = true; … Read more

Custom Post Type Query W/Category Dropdown

You seem to be using 2 separate queries there, the first (query_posts) won’t do anything, and the second is the query that will be used. Have you tried: $args=array( ‘category__in’ => $cats, ‘post_type’ => ‘profiles’, ‘posts_per_page’ => 10, ‘order’=> ‘ASC’, ‘orderby’ => ‘title’ ); $loop= null; $loop = new WP_Query($args); Try that instead of: query_posts(array( … Read more

Magazine style frontpage with multiple categories/loops and no duplicate posts

I wrote a class specifically for passing data between widgets classes using static variables and it will work for your use case as well. Grab the class here. The way you would use this is as follows for each custom loop: $exclude_ids = IntermediaryData::get(); //Retrieve previous exclude IDs $args[‘post__not_in’] = $exclude_ids; //new WP_Query($args); Custom loop … Read more

Notting but the latest post content keeps on being loaded

OK, so you’re not using AJAX (you didn’t share any Javascript here, so I may be confused as to what I’m looking at) but this line: <?php $args = array(‘posts_per_page’ => 1); query_posts($args);?> indicates you are setting the number of posts to be displayed to just 1, hence the “posts_per_page” value being set to 1. … Read more