open
20.10.2022.

How to customize the default wordpress gallery shortcode output

If you paste the following code snippet into functions.php and save or upload it, the default div id gallery will be replaced by the div class gallery in the example below, which you can style in css.

Using this code snippet you can avoid wordpress inserting a style file into the html.

How To Customize The Default WordPress Gallery Shortcode Output

How To Customize The Default WordPress Gallery Shortcode Output

<?php add_filter('gallery_style', function() {return "<div class='gallery'>";});?>
Copy to Clipboard

Related posts

Got a question? Is something not working? Write and I'll answer!

Leave a Reply

Your email address will not be published. Required fields are marked *