WP_Editor – Remove TinyMCE Toolbars

If I remember correctly, this should remove the toolbars on the tinyMCE: function my_format_TinyMCE( $in ) { $in[‘toolbar1’] = ”; $in[‘toolbar2’] = ”; $in[‘toolbar’] = false; return $in; } add_filter( ‘tiny_mce_before_init’, ‘my_format_TinyMCE’ ); References: https://codex.wordpress.org/TinyMCE http://www.tinymce.com/wiki.php/Configuration For the wp_editor, try applying these filter parameters onto your wp_editor() function. Hope it helps. ** Edit Also if … Read more

How I can get image description/title/alt for gallery image?

You need to get the metadata of each image, add this to your functions.php file: function get_post_gallery_images_with_info($postvar = NULL) { if(!isset($postvar)){ global $post; $postvar = $post;//if the param wasnt sent } $post_content = $postvar->post_content; preg_match(‘/\[gallery.*ids=.(.*).\]/’, $post_content, $ids); $images_id = explode(“,”, $ids[1]); //we get the list of IDs of the gallery as an Array $image_gallery_with_info = … Read more

Add option to “Gallery Settings” section

Thanks to the hint with the multiple galleries plugin from Niall Campbell and thanks to this question How to Add a Custom Colum on Thickbox Media Gallery Tab? (where I got the hook admin_head-media-upload-popup from), I was able to complete the task. I’ve added an option to add a style attribute to the gallery shortcode. … Read more

Set default link type to “file” for image galleries

You can override the gallery shortcode link attribute with: add_filter( ‘shortcode_atts_gallery’, function( $out ){ $out[‘link’] = ‘file’; return $out; } ); This means that even if your shortcodes are: the gallery output will always be generated as if you used link=”file”.

how do i create a downloadable gallery with image descriptions?

This is not a bug, it’s a style matter (that maybe renders the Question off-topic). Using the Nextgen Download Gallery plugin, this can be solved by simply applying the following rule to your theme’s style.css file: .ngg-gallery-thumbnail { width: 120px; } Adjusting the width to match your theme’s design. And even the following rule, if … Read more

First three images in post excerpt

You can do this pretty easily using the do_shortcode function. Check if an instance of exists in your post content. Here’s a simple function to drop in functions.php that checks the current post’s content for the gallery shortcode: function gallery_shortcode_exists(){ global $post; # Check the content for an instance of with or without arguments $pattern … Read more

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