New answers tagged

0

If you take a look at native galleries they already have IDs with counter implemented: $instance++; ... $selector = "gallery-{$instance}"; ... $gallery_div = "<div id='$selector'class='gallery... So first gallery within a post will have <div id="gallery-1"... and so on. This is used by core itself to target different styles at each instance. If you ...


0

Gallery Image Captions - Hide/Show I just recalled this caption toggle question, when I was writing this answer, so let me rewrite it a little bit to work for this question. Let's introduce the caption_toggle attribute for the native gallery shortcode, that takes a comma separated string of bool values. It's possible to hide the captions with CSS, but ...


3

Gallery Image Caption - As Title Of The Post It's attached To Here's one way to do it with a custom parent_titles attribute in the native gallery shortcode. This can be achieved by setting suppress_filters to false for the gallery query and modify the posts excerpts through the the_posts filter. We can then check for the custom attribute inputs through ...



Top 50 recent answers are included