Skip to main content




Desde que comencé a desarrollar temas de WordPress 3+ y a usar tipos de publicaciones personalizadas para cosas como portafolios, servicios, preguntas frecuentes, personal, controles deslizantes, etc., he recibido muchas preguntas de persons que me preguntan cómo pueden reorganizar el orden. de sus publicaciones publicadas. Desafortunadamente, no es muy obvio cómo hacer esto en WordPress y no existe una forma extremadamente sencillo y manejable.

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

Method 1: change the publication date

The first method of changing the order of your posts is by changing the publication dates of your posts. Most of the time, themes will use the default order_by => date argument in your topics so that custom posts are displayed in the order they were published (but this is not always the case). To change the publication date, simply click on «quick edit«In any publication of the control panel and modify the date using the fields and then click»to update".

wordpres-post-date-edit-1534532

Method 2: changing the "Menu order" position

If the custom post type (check-in and check-out) supports the "menu_order" function, then at the same time you can change the order by modifying this value. As an example in our Total WordPress Theme we have enabled this for all built-in post types, making it easy to control your post type order for the front-end.

menu-order-wordpress-3156683

Method 3: using the post type order plugin

My favorite way to change the order of your posts is through the "Post Type Order Plugin". This plugin will allow you to easily move your posts by dragging and dropping.

Plugins Page

Method 4: use the pre_get_posts filter

If you want to reorder your items through the code, at the same time it is very easy and you will want to use the pre_get_posts acción en WordPress para hacerlo. Haga clic en el link anterior para conocer todo al respecto. Si prefiere aprender de un ejemplo, ¡eche un vistazo a continuación!

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 );