By default in WordPress whenever you query posts from the database they display in order of publish date with the most recently published item first. So by default your portfolio items will display based on when you added and published the portfolio post. If you want to re-order them there are a few options available:
Re-order Items in Grid/Carousel Visual Composer Module
When you use one of the Total Visual Composer modules such as the Portfolio Carousel and Portfolio Grid modules there are options built-in to alter the order of your items. See the screenshot below:
Custom Order Via a Pluign
If you want a custom order then the easiest thing to do is use a plugin because WordPress doesn’t have any built-in ordering function and it’s not something that should be added to a theme. The plugin we recommend is called “Post Types Order” because it will allow you to give a custom order to any of your posts types (portfolio, staff, testimonials, etc). Below is a video guide showing you how to use the plugin:
Custom Order via Code
Of course it’s also possible to order sections of your site via custom code by hooking into the pre_get_posts filter in WordPress. This is useful for automatic archives like your posts page, categories, tags, etc that come directly from WordPress and not any specific page builder module. Example:
function myprefix_custom_blog_order( $query ) {
// Prevent the code from running in the admin and on a non-main query
if ( is_admin() && ! $query->is_main_query() ) {
return;
}
// Change the order for any blog query (main blog page, categories, tags, date archives, author archives..etc)
if ( wpex_is_blog_query() ) {
$query->set( 'orderby', 'menu_order' );
return;
}
}
add_filter( 'pre_get_posts', 'myprefix_custom_blog_order', 40 );