Responsive Images

To add to the answer from @cristian.raiber, there is no function in WordPress or php to detect screen sizes, and there will in all probabilty never be such functionality. Php runs server side, which runs before clients side which is browser side. As for php, and for that matter WordPress, I cannot see any future … Read more

How to show description under an inserted image?

This is actually quite easy: You just hijack the short code handler for image captions, grab the post_content (the image description) and set its content as a value for the attribute caption. Then you call the original shortcode handler. The following example requires the shortcode attribute desc set to 1 to make the magic work: … Read more

How do i add class=”fancybox” to the default gallery?

You can use javascript/jquery to solve this. When you insert a gallery in a wordpress posts, the whole gallery is wrapped by a div with id like “gallery-1” but also a class that’s always “gallery”. Also, every item is surrounded by two other “dl” and “dt”, with class “gallery-item” and “gallery-icon” respectively. So, you can … Read more

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

How can I alter the [gallery] markup?

Thanks for your replies, Jan & Rarst. They pointed me in the right direction. Here’s what I ended up with. This disables shortcodes in the content. Perfect for this site & the function gets attached images & spits them out as a list. (I found the function somewhere & slimmed it down a little) // … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24eduedusedueduedusedusedueduedusedu