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

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

show all in query_posts on category.php?

You could add a url parameter for posts per page. Something like this: $pppage = ( get_query_var( ‘posts_per_page’ ) == ‘all’ ) ? -1 : 45; query_posts( array( ‘posts_per_page’ => $pppage ) ); then you can set your URL with the parameter posts_per_page=all if you want to show all the posts, if it doesn’t find … Read more

query_posts call sets is_home() to true

Don’t do it this way. query_posts() should not be used most of the time and you are really hacking things up here with direct template inclusion and such. Create new page Blog (no template). Go to Settings > Reading. Assign this page as Posts page.

Why would post_type be ignored in this query?

Check if your post_type is exactly listings and not listing. Also check this approach: <?php function filter_where( $where=”” ) { $where .= ” AND post_date > ‘2009-03-01′”; return $where; } add_filter( ‘posts_where’, ‘filter_where’ ); function parse_wp_query( $query ) { $query->set( ‘post_type’, array( ‘listings’ ) ); return $query; } add_filter( ‘parse_query’, ‘parse_wp_query’ ); $posts = query_posts( … Read more

Issue with sidebar widgets not showing when I do custom queries

When you do a query, you change the environment, specifically the current post and query objects. To reset things back to how they were before the query loop you should: query_posts(‘post_type=offered’); if(have_posts(){ while (have_posts()) : the_post(); ?> ….content endwhile; } wp_reset_query(); // reset query!!!! or $wanted_query = new WP_Query(‘post_type=wanted’); if($wantedquery->have_posts()){ while ($wanted_query->have_posts()) : $wanted_query->the_post(); ….content … Read more

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