I'm having a strange issue with sorting by post date.
I created a slideshow post type and it does by default order by post date but If I change the date posted through the admin the order doesn't update in the query, but it does get updated in the admin.
The Post Type
/* Slideshow Post Type */
add_action('init', 'slide_init');
function slide_init() {
$labels = array(
'name' => _x('Slides', 'post type general name'),
'singular_name' => _x('Slide', 'post type singular name'),
'add_new' => _x('Add New', 'slide'),
'add_new_item' => __('Add New Slide'),
'edit_item' => __('Edit Slide'),
'new_item' => __('New Slide'),
'view_item' => __('View Slide'),
'search_items' => __('Search Slides'),
'not_found' => __('No slides found'),
'not_found_in_trash' => __('No slides found in Trash'),
'parent_item_colon' => '',
'menu_name' => 'Homepage Slides'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title', 'editor', 'thumbnail')
);
register_post_type('slide', $args);
}
The Query
// Slideshow Query
$slideshow_args = array(
'post_type' => 'slide',
'posts_per_page' => '10',
);
$slideshow = new WP_Query( $slideshow_args );
Edit - -
I found out this has something to do with this line of code.
$slideshow_post_count = $slideshow->post_count;
<?php if ($slideshow_post_count > 1) : ?>
<div class="controls span6">
<span class="next"></span>
<span class="pause"></span>
<span class="prev"></span>
</div>
<?php endif; ?>
var_dump
ing the wp_query object to see what it was really trying to do. No caching, all plugins disabled?