Blogging

How to Reorder Posts in WordPress and WooCommerce

WordPress, by definition, organizes posts in reverse chronological order (newest to oldest), or rather, according to the published date. This works for most publishers, but you may need to rearrange articles on occasion. It is possible that you have a custom post type where you need to rearrange a WooCommerce product that you would like to appear at the top of your shopping page. Check out these different solutions and tricks for rearranging posts in WordPress.

How to Reorder Posts in WordPress

Below are some approaches and options for reordering your posts.

Option 1 – Reorder Publications Changing the Publication Date

Most WordPress themes use the post date parameter ‘order by‘. So the first method you can use to reorder posts is changing the publication date of the article. This can be a quick way to reorder a post or two, but WordPress doesn’t have an ideal method for doing a bulk reorder. If you need to reorder many posts at once, we recommend using one of the other options below.

Looking at the publications below, we can see that these two articles were published on the same date. And the last one published is the one that appears at the top of our blog. However, in this case, we want the previous post to appear first. So, to change the order, we can change the publication date. To do this, click “Edit” below the post title.

Edit WordPress Post
Edit WordPress postEdit WordPress post

On the right side, you can select a new publication date (one more recent than the previous one) and then click “Update”.

Reorder publication by changing the publication date
Reorder publication by changing the publication date

Now you can see that the article is above the other at the top. And this will be reflected on your blog as everything is displayed in reverse chronological order.

The publication is now at the top
The publication is now at the top

If you don’t want to drastically change the dates, you can simply change the time (as seen below, WordPress uses the military time zone by default). Even if you set it to a second later, the result will cause the article to be reordered.

change publish time on post

Changing the time can be useful if, for example, you have an automated RSS email marketing campaign about to run and you need it to gather the posts for that day, but you only need to reorder one or two posts.

Option 2 – Reorder Posts in WooCommerce (Built-in Drag-and-Drop Method)

Many people may be unaware of this fact, but WooCommerce has a functionality built into its plugin which allows drag and drop. To use it, click on your “Products” page and on “Rating” at the top. You can hover over a product and drag it to change the order. And this directly changes the order in which they appear on the front of your shopping page.

 

Sorting products in WooCommerce
Sorting products in WooCommerce

To reorder products in WooCommerce, you can also change the “menu order” custom meta field. If you click on your product, on the “Advanced” tab you can assign a product a menu order like 0, 1, 2, 3, 4. This would then be reflected on the dashboard and on the front of your store. You can also use negative numbers. For example, if you have a product that you want to display at the top and you have already assigned orders before, you can use -1 or -2. Some themes will also have menu orders available, which can be changed in custom post types.

Change menu order in WooCommerce
Change menu order in WooCommerce

You can also quickly change the catalog on the front of your store page by changing the product’s default rating. To do this, click on WooCommerce settings and click on View under the “Products” tab. You can then select the following options from the standard product classification:

  • Order by default (custom order + name)
  • Popularity (sales)
  • average score
  • Sort by most recent
  • Sort by price (asc.)
  • Sort by price (desc.)
Organization of products in WooCommerce by default
Organization of products in WooCommerce by default

And finally, you can also use a plugin to reorganize products in WooCommerce and EDD, see the next option below.

Option 3 – Reorder Posts in WordPress With a Plugin

One of the simplest ways to reorder posts in WordPress is to use a plugin. We strongly recommend the free plugin Post Types Order. This allows you to reorder posts, pages, custom post types, and products (WooCommerce e EDD) using a JavaScript drag-and-drop feature.

Plugin Post Types Order
Plugin Post Types Order

It currently has over 400,000 active installs with a 4.5 star rating. You can download the Post Types Order at repository do WordPress or looking in your painel WordPress click on “Add New”. After enabling it, click “Post Types Order” in settings and you can enable the types of posts you want the reorder interface to display.

Post Types order
Post Types order

Then, under that type of post, you will see a new menu called “Reorder”. You can drag and drop posts in the order you want them to appear. In this example, we will make a custom post type for Testimonials.

Drag and drop to reorder custom post types
Drag and drop to reorder custom post types

Given that the WordPress theme has custom styles for this custom post type, rearranging them with the plugin allows us to control exactly how they are displayed on the page. So, in a way, reordering with this plugin can affect the design and feel of your site.

Organize custom post types
Organize custom post types

And you can also rearrange any type of post with the plugin. It’s quick and easy!

Option 4 – Reorder Posts in WordPress With Code

Your last option is to reorder WordPress posts with custom code. Here’s an example of the organization of your publications on the front, done in ascending order by title. To ensure your customizations stay in place when you update your theme, start making a backup of your website e creating a child theme. Then put this in your theme’s functions.php file.

function change_posts_order( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'orderby', 'title' ); 
$query->set( 'order', 'ASC' );
}
}
add_action( 'pre_get_posts', ' change_posts_order ' );

Also hire a WordPress developer to create your own custom ordering query.


Save time, costs and optimize your website performance with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise Integration.
  • Global reach with 34 data centers worldwide.
  • Optimization with our built-in application performance monitoring.

All this and more in a plan with no long-term contracts, assisted migrations, and a 30-day money-back guarantee. Check out our plans or contact sales with sales to find the right plan for you.

Shares:

Leave a Reply