How To Set Custom Width For Tiled Photo Galleries In WordPress?

With Jetpack Tiled Galleries you can display your image galleries in three new styles: a rectangular mosaic, a square mosaic, and a circular grid. All three gallery styles are beautiful, specially the Tiled Mosaic but in some full width WordPress themes a common problem comes, default width of gallery. Sometime width defined by the theme is less than website’s actual width and in that case gallery automatically aligns itself and starts showing space on other sides which looks odd. Tiled Galleries are built to fill your theme’s content width but occasionally themes forget to set the $content_width variable in functions.php and hence Tiled Galleries auto defaults to 500px wide. This tutorial explains you how you can easily edit the gallery width according to your website’s layout.

How To Define A Specific Width For Your Galleries?


Open your theme’s function.php file and look up for $content_width = 800;

Now change the width. In-case, there is no such line then you can define a specific $content_width value by adding the following code to your theme’s functions.php file:

if ( ! isset( $content_width ) )
    $content_width = 800;

You can read more about the Content Width theme feature here.


Custom Content Width plugin make things more easy. Simply install and activate it, upon activation visit your Dashboard -> Settings -> Media screen and you can set the custom content width there without digging into your theme’s function file.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.