Tag Info

New answers tagged

1

You should use the pre_get_posts filter for this. For example, you could do this in your theme's functions.php file: function limit_category_posts( $query ) { if ( $query->is_archive() ) { // Do not do this for the date or category archives. if ( $query->is_date() || $query->is_category() ) return $query; ...


0

Your English isn't clear to me. What I understood is that you want to list archives of posts with specifications. Like, posts from the first week January, year 2013. Well, there is a dedicated function for this purpose and it's: wp_get_archives(); For example, if you want posts of the first week of January, year 2013: $args = array( 'type' => ...


0

Using query_posts is generally not recommended. Looking at the Codex, it specifically states: 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. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it ...


1

As Tom said, you should never use query_posts and should almost always pass any arguments as an array. I think this will achieve what you want: <?php // Arguments $args = array(' 'nopaging' => true, 'terms' => 'featured', 'posts_per_page' => 15, 'orderby' => 'rand', ...


0

This doesn't answer the question you asked, but based on your comment, you don't need two queries to do what you want. A query object is basically just a collection of posts with an internal counter. You can start / stop / manipulate that counter to get the output you want. if( have_posts() ){ the_post(); // output post #1 here } // stuff in ...


1

Please note: This is just an extension to the other answer As already mentioned in the other answer, orderby and order are invalid arguments supplied for register_post_type You should take your time and work through the link provided above. I just also want to raise this, you cannot use calender as your post type name. It is a reserved name.You will have ...


4

You don't declare the order of the results when you register the post type. Instead, you do at the time the results are requested. If you're using WP_Query to get the results then you add your orderby and order arguments to the request. http://codex.wordpress.org/Class_Reference/WP_Query If you want to change the order of the results on the archive pages ...



Top 50 recent answers are included