Jetpack by WordPress.com
[resolved] Change Width of Tiled Gallery Using css (4 posts)

  1. mbh66
    Posted 3 years ago #

    Hi there,

    I'd like to change the width of a Jetpack tiled gallery using css. I have read this post about changing the width in functions.php: http://jetpack.me/2013/01/04/galleries/#comment-10121

    However, my theme does currently set a width:
    .columns > .content { width: 640px; float: left; }

    What classes and coding should I use in Custom CSS to, for example, change the width of the gallery to 630? Here is the gallery page:

    Many thanks!


  2. Jeremy Herve
    Jetpack Mechanic
    Plugin Author

    Posted 3 years ago #

    The width set in CSS and the $content_width value are different. Since the Tiled Galleries (along with other media elements like embedded videos and pictures) use that $content_width to calculate the width of each picture in the gallery, you'll want to make that change to your functions.php file.

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

    If you cannot edit your theme's functions.php file, you can add this code in a plugin.

  3. Angie Meeker
    Posted 3 years ago #

    So if my theme does define the content width already:

    /** Sets Content Width */
    $content_width = apply_filters( 'content_width', 680, 680, 1020 );

    but I want to use a tiled gallery on a full width page (which would use the 1020 width), how can I force the gallery on that page to use the full width?

  4. Jeremy Herve
    Jetpack Mechanic
    Plugin Author

    Posted 3 years ago #

    You can take the example of Twenty Twelve to define different $content_width values depending on the page:

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic