Gallery Inside One Post

These functions will help: //function to get next or previous keys in an array function array_navigate($array, $key){ $keys = array_keys($array); $index = array_flip($keys); $return = array(); $return[‘prev’] = (isset($keys[$index[$key]-1])) ? $keys[$index[$key]-1] : end($keys); $return[‘next’] = (isset($keys[$index[$key]+1])) ? $keys[$index[$key]+1] : current($keys); return $return; } function previous_attachment_ID($att_post){ //get the attachments which share the same post parent $images … Read more

Best approach when modifying the Media Manager

This is my go to snippet for things like this. <?php add_action(‘print_media_templates’, function(){ // define your backbone template; // the “tmpl-” prefix is required, // and your input field should have a data-setting attribute // matching the shortcode name ?> <script type=”text/html” id=”tmpl-my-custom-gallery-setting”> <label class=”setting”> <span><?php _e(‘My setting’); ?></span> <select data-setting=”my_custom_attr”> <option value=”foo”> Foo </option> … Read more

Make a really simple gallery structure

Use your own gallery shortcode handler – something like this in your functions.php: function __my_gallery_shortcode( $attr ) { // render the gallery the way you want it } add_shortcode( ‘gallery’, ‘__my_gallery_shortcode’ ); To get you started, you could just copy the code from the default handler gallery_shortcode(), and edit as you require.

Custom wordpress gallery option

WordPress doesn’t make it very easy to modify aspects of the gallery shortcode. Some attributions: Thanks to user peterbra for really putting the whole thing together a year ago. Thanks to user birgire for coming up with a solution as far as adding the attribute in a meaningful way. The other option besides birgires ( … Read more