Tag Info

Hot answers tagged

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 ...


2

As stated in my comment to the OP, you should make use of pre_get_posts to target change the query variables as needed before the main query is executed. Just a tip, pre_get_posts uses the same exact parameters as WP_Query, so you can have a look at those parameters and use them to construct your pre_get_post action parameters to modify the query variables ...


1

As I said, this is doable, but we need to do careful planning as this is quite a heavy operation. On my test installation with a post count of just 13 posts, and 3 terms per taxonomy, the db is visited 20 times and the complete operation takes 0.03613 seconds. I have tried a couple of solutions, and this one is by far the fastest. We will look at a ...


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 ...


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', ...



Only top voted, non community-wiki answers of a minimum length are eligible