I would like to add a custom css class to the native WordPress gallery. For example, this one outputs the following HTML:
<div id="gallery-2" class="gallery galleryid-1715 gallery-columns-4 gallery-size-thumbnail">
I’d like to just add in a custom class of iwmp
.
What’s the best way of doing this? I was hoping for a non JS solution. Thanks
EDIT: Answered my question below.
This link solved my problem: http://www.sk23.co.uk/wordpress/how-to-override-the-default-wordpress-gallery-embedded-css-styles-in-wp/
You have to remove the default gallery shortcode, and create your own. What I did was copy n paste it, and add in the new class.
Thanks
You should just be able to put your custom class in the list of classes and then, in your css file, describe the properties associated with that class.
For example:
Your html would be
And then let’s say you wanted everything in class iwmp to have a red background color and have center alignment you would add the following to your css file:
CSS addition: