function gallery_first( $content) {
$expr="/\[gallery(.*?)\]/i";
return preg_replace_callback( $expr, create_function('$matches', 'return do_shortcode($matches[0]);'), $content);
}
add_filter( 'the_content', 'gallery_first', 6); // prio 6 executes this function previous to all other filter functions
Related Posts:
- Shortcode pagination not advancing
- Display gallery on bottom after content
- Native gallery custom html output
- Gallery Shortcode Function Help
- How to manually fix the WordPress gallery code using PHP in functions.php?
- How to display random users with avatars
- Creating a table from shortcode avoiding wpautop for each row
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Stripping shortcode from custom excerpt function
- how to create shortcode in wordpress
- Formatting post content to exclude gallery
- Gallery images titles – get from post
- Remove images from get_the_excerpt
- Shortcode with custom content attribute?
- Problem with extract() with custom shortcode
- Shortcode to insert menu in page body?
- Using locate-template & shortcodes doesn’t appear to work
- Displaying a random user with a shortcode
- Passing HTML in WordPress Shortcode arguments
- Function to show only first instance of shortcode
- creating shortcode to pull json array
- Custom Shortcode, functions PHP WP_Query loop
- Pass Shortcode Attribute to footer Script
- Super simple shortcode not working
- How to use thumbnails in gallery?
- List child pages of specific page using shortcode
- Converting html to wordpress images not showing
- How to extract the variables out from “add_shortcode” function?
- Default Gallery Edit/Template Editable?
- WordPress shortcode attributes for database SELECT?
- create shortcode to list users with specific meta key value
- Variable if post is sticky in functions.php
- How to add ‘data-caption’ inside an anchor tag
- Shortcode inserts paragraphs before and after executing shortcode
- Display post shortcode content in the sidebar?
- Using shortcode content with nested shortcode
- how can I edit flexslider in woocommerce. [Urgent]
- How can I make a widget shortcode to control all the widgets?
- Custom shortcodes not inserting into visual composer columns
- Setting youtube size in functions.php
- Adding a colorbutton in tinymce dialog with current api
- Passing variable as add_shortcode argument
- Excerpts are not displayed by a shortcode on category pages
- check if the user is owner of current page
- shortcode help require
- Optimizing a WordPress site
- Use html inside shortcode function
- wp_nonce_field is breaking form for reasons unknown
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- Function shortcode – Set Parameter
- Using multiple line variable inside a function?
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- Echoing function into WordPress NextGen gallery
- Output loop to function return?
- How to echo the value of an array element using a function via a shortcode
- Wp-query Order By problem
- How to parse a shortcode within a shortcode?
- Variables not showing in short code
- How to include any template using Shortcode fuction?
- Need to convert image url to a Base_64 data url with wordpress function..
- How to create shortcode with html and php content?
- Shortcode question
- Shortcode to get featured image of specific id post
- Modify shortcode to work with custom post types
- shorthand syntax for custom fields
- show all the posts thumbnails
- Problem with shortcode inside a shortcode
- Need help making a short code work
- Display a list of random terms from custom taxonomy with shortcode
- Create shortcode for metabox gallery
- Load templates, pass arguments, and render output from functions.php
- Passing function arguments via a shortcode
- Customizing the wp_video_shortcode output with add_filter
- a SET of wordpress native galleries with title and text?
- Probleme shortcode with list author
- Last updated posts shortcode in functions.php
- Shortcode to output category description by passing ID
- Help using ShortCodes to style whole chunks of the post
- Shortcode to insert default text and change one word throughout it?
- Shortcode Initialization in a Custom Theme
- Hide disclaimer from summary excerpts
- HowTo: Add wrapper to columns shortcode?
- Function not receiving string from shortcode
- Shortcode Function – Can’t get anything else to return after running shortcode within shortcode
- Custom shortcode with do_shortcode and substr
- Can I use a function to return HTML and the result of another function?
- Problem in shortcode outputting content
- Expanding a function to call a plugin or show a link
- Remove Captions from Custom Gallery function.php
- Trying to the deduce shortcode from a function
- Pull random comment from specific post, display on homepage with shortcode
- Set thumbnail from URL, by grabbing image in functions.php
- Run function from parent on child site
- Echo custom field value in shortcode function
- Shortcode Variations?
- Shortcodes not outputting in correct divs
- Custom shortcode not being included in content paragraph [duplicate]
- Creating mixture of shortcodes to use in the visual/text editor
- PHP error in shortcode [closed]
- multible shortcodes (for differnt values) with one function