How to show several galleries in one line

You have the possibility to display several galleries (with enabled option “Display only first image”) in one line on your page.

This is the simple example of how it looks:

Two galleries

To do this:

  1.  Go to the Appearance menu at WordPress Dashboard and open Editor:
    Gallery select editor
  2. In the right list find footer.php and open it:
    Editor footer
  3. In this window before string
<?php wp_footer(); ?>

you need to enter the code below:

(function($) { 
$('').each(function() { 
var $this = $(this);
display: 'inline-block',
width: $'width') + 'px',
margin: $'offset') / 2 + 'px' 
}).wrapAll($('<div>').css('text-align', 'center'));

Don’t forget to save your changes by clicking on “Update File”.

Now you are able to display your galleries in one line.


Latest Articles