All Collections
FAQ's and Troubleshooting
Changing The Order Of The Divi Portfolio Items
Changing The Order Of The Divi Portfolio Items

You can order the portfolio items by title, by date, alphabetically etc...

Karen avatar
Written by Karen
Updated over a week ago

We may want to change the order of the Portfolio items in Divi since there is no general order option to do it. We can make it work with some customization.
โ€‹
You will need a child theme to apply these changes.
The Child theme is needed to keep the changes intact in case you update/reinstall your Divi theme. To learn about it or get more info please check the following tutorial first: How To Make A Child Theme

To change the default order of the Divi Portfolio items (projects), you can add the following code to the functions.php file in your child theme folder:

// Order the portfolio items by title
add_action( 'parse_query', function( $vars ) {
if ( isset($vars->query['post_type']) ) {
if ( 'project' == $vars->query['post_type'] )
{
$vars->set( 'orderby', 'title' );
$vars->set( 'order', 'ASC' );
}
}
}); // end custom order


WordPress allows you to select a lot of order options. In the code above you can modify the following two lines to change the order method to something else:

$vars->set( 'orderby', 'title' );
$vars->set( 'order', 'ASC' );


You can find all of the available order parameters here:
โ€‹

The changes will affect all of your portfolio products. It's currently not possible to apply these changes only to a certain portfolio module.ย 

Did this answer your question?