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

Allow filtering of loops for all categories

I would recommend defining a query var to define your custom filters, and then pass the (sanitized) value of that query var to query_posts() (to alter the primary Loop, if that is your ojbective). First (in functions.php), define your query var: <?php function wpse47974_queryvars( $qvars ) { $qvars[] = ‘wpse47974_filter’; return $qvars; } add_filter( ‘query_vars’, … Read more

Want Page Descendants when using query_posts post_parent or child_of

If you don’t have to use query_posts() then this is one method: function my_menu() { global $post; if(!$post->post_parent){ // will display the subpages of this top level page $children = wp_list_pages( array( ‘title_li’ => ”, ‘child_of’ => $post->ID, ‘echo’ => 0 ) ); } elseif($post->ancestors){ // diplays only the subpages of parent level $ancestors = … Read more

Exclude current post ID from loop in sidepbar.php

First, do not use query_posts() for secondary loops. The query_posts() function is intended only to modify the primary loop query. Use WP_Query() or get_posts() for secondary loop queries. Also, showposts is deprecated. Use posts_per_page instead. Let’s use WP_Query(), as it will be the most analogous to your current implementation: <?php // First, let’s eliminate some … Read more

Sticky posts don’t show up first in custom loop

DO NOT USE query_posts() FOR CUSTOM LOOPS! Use WP_Query() instead. <?php $paged = get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1; $custom_cat_query_args = array( ‘paged’ => $paged, ‘category_name’ =>’home,tumblr’ ); $custom_cat_query = new WP_Query( $custom_cat_query_args ); By default, ignore_sticky_posts is set to 0, or do not ignore. So, the custom loop should handle sticky … Read more

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