How do i display the built-in gallery inside a widget?

Widgets don’t usually allow shortcodes in them (they treat them as normal text). What you have to do, is to tell this widget, it should run do_shortcode on it’s text. To do it, you can use this snippet: add_filter(‘widget_text’, ‘do_shortcode’); Just place it in your function.php file. Then you can place shortcodes in Text Widget … Read more

Remove hyperlink on gallery shortcode

Update: It looks like there exists an attribute link=”none” after all 😉 For example: So we don’t need to reinvent the wheel, like in my previous answers 😉 Previous: Plugin to handle link=”no” in the gallery shortcode: Here’s a demo plugin to add the option to remove the image links in the gallery. You can … Read more

Add container div to gallery using post_gallery

Adding an HTML wrapper to the gallery can be done using the post_gallery filter. Here’s a fully commented example. add_filter( ‘post_gallery’, ‘gallery_custom’, 10, 3 ); /** * Filters the default gallery shortcode output. * * If the filtered output isn’t empty, it will be used instead of generating * the default gallery template. * * … Read more

How can I remove “”

The default Shortcode will add that markup when necessary and only if the active WordPress theme didn’t enable HTML5 support for the gallery Shortcode’s markup/output. Or, in rare cases, a plugin or a custom code may have disabled the support. So an easy way to get rid of that <br> tags, is by enabling HTML5 … Read more

How to use thumbnails in gallery?

There is a project going on about the image sizes. You can follow it right here. Right now, you can try using shortcode_atts_gallery filter. Take a look at these codes to get a hint: /* Register shortcode_atts_gallery filter callback */ add_filter( ‘shortcode_atts_gallery’, ‘meks_gallery_atts’, 10, 3 ); /* Change attributes of wp gallery to modify image … Read more

WordPress grab first image from gallery

I had the same issue and was previously using get_children() to retrieve the top 4 images from a gallery for a given page. Here’s the solution I came up with: // helper function to return first regex match function get_match( $regex, $content ) { preg_match($regex, $content, $matches); return $matches[1]; } // Extract the shortcode arguments … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)