query_posts ignores the argument

Don’t use query_posts this will alter your main loop, you can query posts by day 1-31 using WP-Query(); $day = date(‘j’); $args = array( ‘day’ => $day); $day_query = new WP_Query($args); if ($day_query->have_posts()) : while ($day_query->have_posts()) : $day_query->the_post(); //show posts endwhile; wp_reset_postdata(); endif;

‘all’ hook and add_action issue (class based plugin)

First, template_redirect is a front end hook. It never fires on your backend save. You need to choose a backend hook such as admin_init to hook your function. Secondly, based on your pastebin from you other question, your code has the checked attribute hard-coded for both of your radio boxes, thus causing it to default … Read more

What is the best way to get the first few post from WordPress in different divs using a loop?

Use this code for the loop. I removed your comments and added some for clarification. <?php if ( have_posts() ) { // Do first post. add_filter( ‘the_content’, ‘narga_excerpts’ ); add_filter( ‘the_content’, ‘remove_first_image’ ); the_post(); get_template_part( ‘content’, get_post_format() ); // Do remaining posts. remove_filter( ‘the_content’, ‘narga_excerpts’ ); remove_filter( ‘the_content’, ‘remove_first_image’ ); while ( have_posts() ) { … Read more

Error trying import one category on page

As per the codex query_posts Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. Double Note: query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the … Read more

Pagination not working with custom loop

I’ve run into this problem with PageNavi before. My solution is to hijack the $wp_query variable temporarily and then reassign it after closing the loop. An exmaple: <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args=array( ‘post_type’=>’post’, ‘cat’ => 6, ‘posts_per_page’ => 5, ‘paged’=>$paged ); $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query($args); /* … Read more

Display Custom Taxonomy of custom post type

I am assiming you already register taxonomy which show you correct links (and generate correct rewrite rules)… but lets make a checklist. 1) Register Taxonomy and assign it to different post types done by you… 2) Modify a rewrite rules add_filter(‘locations_rewrite_rules’, ‘se_119400_locations_rewrite_rules’); function se_119400_locations_rewrite_rules(){ $rules = array(); $rules[‘location(/?(([^/]+?)(/page/?([0-9]{1,})/?)?)?)$’] = ‘index.php?locations=$matches[3]&paged=$matches[5]&post_type=any’; return $rules; } 3) Taxonomy … Read more

Make assigning post to a specific category equivalent to assigning it to all categories

One way to deal with the problem is to use the redirect_canonical filter to cancel the redirect (that happens when the category that the post is assigned to doesn’t match the category slug in the requested post URL) for posts assigned to International (intl) category. /* * Related core file: wp-includes/canonical.php * * NOTE: If … Read more