How to Change Portfolio or Project Gallery Image Sizes for Divi

by | Jun 5, 2018 | How To, Divi Theme | 1 comment

Unfortunatly, you cannot change the sizing of gallery images for the portfolio grid in the CSS file. In this particular case, it’s just a few lines of PHP code you’re going to throw into your child themes functions.php file. Just make sure the featured images you add are all the same size and you should be good to go. I’ve done many websites for authors and this is a great module to use to display a list of books and organize them by subject.

Another handy SEO trick is to change the URL of the permalink for projects to something more specific. In the particular case of author websites, we would want to change “projects” to “books”. In the code below, simply change “project” to the naming of your choice.

If you don’t know what a child theme is, you should consider using one if you are a professional developer. That way any customizations, such as this one, are never lost with updates to the theme. To learn more about child theme, see the WordPress codex documentation of it or read about it on the Elegant Themes website.

Insert this code in Functions.php

//* Change Image Width and Height for Portfolio Image Gallery
add_filter( ‘et_pb_portfolio_image_height’, ‘portfolio_size_h’ );
add_filter( ‘et_pb_portfolio_image_width’, ‘portfolio_size_w’ );

function portfolio_size_h($height) {
return ‘9999’;
function portfolio_size_w($width) {
return ‘9999’;

//*Change permalink url for projects
function custom_post_name () {
return array(
‘feeds’ => true,
‘slug’ => ‘project’,
‘with_front’ => false,
add_filter( ‘et_project_posttype_rewrite_args’, ‘custom_post_name’ );

The following code to modify the url structure of projects was provided by Elegant Tweaks.

Divi portfolio gallery image grid

Sortable portfolio grid for divi using changed images sizes to display a. Gallery of books.

Ravenous Raven Design
Google Rating
Based on 19 reviews