... ...

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:

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

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

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

 

Categories
Latest Articles