Orderby menu_order doesn’t work
Use this instead. It worked for me ‘sort_column’ => ‘menu_order’
Use this instead. It worked for me ‘sort_column’ => ‘menu_order’
Sticky posts do add to the post count rather than being included in it. You can alter your query to ignore sticky posts though. $allposts = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 20, ‘ignore_sticky_posts’ => true ); But you are also missing pagination parameters. $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $allposts = array( ‘post_type’ … Read more
It looks like your syntax is a little off for the tax query. Try this: $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘cat’ => ‘-1’, ‘posts_per_page’ => 2, ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_format’, ‘field’ => ‘slug’, ‘terms’ => array(‘post-format-aside’, ‘post-format-gallery’, ‘post-format-link’, ‘post-format-image’, ‘post-format-quote’, ‘post-format-status’, ‘post-format-audio’, ‘post-format-chat’, ‘post-format-video’), ‘operator’ => ‘NOT IN’ ) … Read more
Pretty much the solution is to include all mimes except images. WordPress has a nifty little function where it keeps all it’s accepted mime-types called get_allowed_mime_types() ( cleverly named ) which returns an Array() of mimes. All we need to do is get the difference between the returned array and the array of mime-types we … Read more
The following 3 parameters will give you the posts in Ascending order from the date it was published (i.e The older posts will be shown first) ‘post_status’ => ‘publish’, ‘orderby’ => ‘publish_date’, ‘order’ => ‘ASC’ When you change the order to DESC you will get the posts in Descending order from the date it was … Read more
Here’s an idea, however it will require the ability to make custom SQL queries – with $wpdb. Since you want to get posts followed by a user, you can create a view, with the following structure: id user_id post_id post_title post_content … (all other post fields) don’t worry about duplicating posts. When you select, you … Read more
As @Milo pointed out in the comments above, custom post types and taxonomies are registered on init, so this would seem to be the earliest hook available that is guaranteed to work for all content.
I just got the same problem and the problem was exclude_from_search post_type option. It seems that WordPress got a bug (I’m just going to report it), that when you got exclude_from_search false, the posts do not show on tax pages
Custom query incorrectly returning everything [closed]
First of all, never use query_posts, ever. My emphasis. It is outright not meant to be used at all, and should be removed in future wordpress versions. Overall performance wise I would say it is even worse than a custom query. You should really be using WP_Query for the task at hand Note: This function … Read more