Skip to main content
How to Change the Order of the Divi Portfolio Items

Customize the Portfolio module to change the order in which the Project post are being displayed by default.

Updated over a week ago

You may want to change the order of the Portfolio items in Divi since there is no general order option. This can be done by customizing the Portfolio module.
โ€‹
A child theme is needed to apply these changes. The Child theme keeps the changes intact if you update/reinstall your Divi theme.

For more information, 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 on WordPress's official documentation page.
โ€‹

Note: The changes will affect all of your Portfolio modules. It's currently impossible to apply these changes only to a certain portfolio module.

Did this answer your question?