banner



How To Chnage Order Of Posts In Wp Blog Page

How To Reorder Standard & Custom Post Type Posts In WordPress

Last updated on:

Ever since I started developing WordPress 3+ themes and using custom post types for things such as portfolios, services, faqs, staff, sliders..etc, I've been getting a lot of questions from people asking me how they can rearrange the order of their published posts. Unfortunately it's not very obvious how to do this in WordPress and there isn't a very easy and manageable way.

In the following post I'll show you how you can e-order your custom posts using two different methods: changing the post date of your custom post or using a super awesome free WordPress plugin called "Post Type Order".

Method 1: Change Post Date

The first method of changing your posts order is by changing the published dates of your posts. Most the time themes will use the default order_by => date argument in their themes so custom posts will show up in the order in which they were published (but it's not always the case). To alter the post date simply click " quick edit " on any post in the dashboard and alter the date using the fields then click "update".

wordpres-post-date-edit

Method 2: Altering the "Menu Order" position

If the custom post type (registration and output) supports the "menu_order" function then you may also be able to change the order by altering this value. For example in our Total WordPress Theme we've enabled this for all built-in post types making it easier to control your post type order for the front-end.

menu-order-wordpress

Method 3: Using The Post Type Order Plugin

My favorite way of changing the order of your posts is by using the "Post Type Order Plugin". This plugin will allow you to easily move your posts around in a drag-and-drop fashion.

Plugin Page

Method 4: Using the pre_get_posts Filter

If you want to re-order your items via code its also very easy and you'll want to use the pre_get_posts action in WordPress to do so. Please click on the former link to learn all about it. If you rather learn from an example, please have a look below!

            function wpex_order_category( $query ) { 	// exit out if it's the admin or it isn't the main query 	if ( is_admin() || ! $query->is_main_query() ) { 		return; 	} 	// order category archives by title in ascending order 	if ( is_category() ) { 		$query->set( 'order' , 'asc' ); 		$query->set( 'orderby', 'title'); 		return; 	} } add_action( 'pre_get_posts', 'wpex_order_category', 1 );          

Subscribe to the Newsletter

Get our latest news, tutorials, guides, tips & deals delivered to your inbox.

How To Chnage Order Of Posts In Wp Blog Page

Source: https://www.wpexplorer.com/order-custom-post-type-posts-wordpress/

Posted by: buntinthim1975.blogspot.com

0 Response to "How To Chnage Order Of Posts In Wp Blog Page"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel