At first – do not use extract. It’s very bad code style and is also depracated in core.
Every time your foreach loop run, you override content of $output because you assign to this variable new content. What you want is to concatenate new list item with existing ones. This can be done using concatening assignment operator:
$output .= '<li class="text-center"> <img src="' . $carouselimage['url'] . '" title="' . $carouselimage['title'] . '" alt="' . $carouselimage['alt'] . '" /></li>';
$output variable should be defined before your foreach statement. Just assign to it an empty string.
Related Posts:
- Use AJAX in shortcode
- functions.php inject inline css
- How to add attributes to a shortcode
- How to display random users with avatars
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- Can shortcodes contain conditional statements? Even without them my shortcode renders blank page
- 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
- Formatting post content to exclude gallery
- Shortcode with custom content attribute?
- Shortcode to insert menu in page body?
- Passing HTML in WordPress Shortcode arguments
- Function to show only first instance of shortcode
- Display a text message if the shortcode is found?
- Custom Shortcode, functions PHP WP_Query loop
- Super simple shortcode not working
- Display gallery on top before content
- How to extract the variables out from “add_shortcode” function?
- How to get specified parent page title in my function
- Possible to display shortcode based on the category?
- Shortcode pagination not advancing
- Run function when WordPress new multisite is created or ACF field is updated
- Display post shortcode content in the sidebar?
- How to get the index number of the posts?
- Get Current Post ID in functions php, meta query filter
- Using shortcode content with nested shortcode
- Custom shortcodes not inserting into visual composer columns
- How to filter $content in shortcode function
- Setting youtube size in functions.php
- Adding a colorbutton in tinymce dialog with current api
- Display gallery on bottom after content
- Excerpts are not displayed by a shortcode on category pages
- WordPress Shortcode function display outside of widget
- check if the user is owner of current page
- shortcode help require
- ACF not showing
- 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?
- Echoing function into WordPress NextGen gallery
- How to echo the value of an array element using a function via a shortcode
- Wp-query Order By problem
- Access category within rss2_head hook?
- Can set_post_thumbnail be used to remove a thumbnail?
- How to parse a shortcode within a shortcode?
- Variables not showing in short code
- Compare meta key to current date in pre get post
- 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
- Can I include a custom PHP function in a WordPress function?
- Shortcode to get featured image of specific id post
- Modify shortcode to work with custom post types
- shorthand syntax for custom fields
- Insert a field with PREG_REPLACE – strange behaviour
- Perform function on publish AND save (not just save)
- show all the posts thumbnails
- Problem with shortcode inside a shortcode
- Need help making a short code work
- How to display an image before title text in menu items
- Display a list of random terms from custom taxonomy with shortcode
- Load templates, pass arguments, and render output from functions.php
- Probleme shortcode with list author
- Last updated posts shortcode in functions.php
- Help with with my function for wordpress
- Shortcode to output category description by passing ID
- Help using ShortCodes to style whole chunks of the post
- ACF Date Form in Custom Admin Field
- Comment function for page
- ACF Filter return value
- Display list of pages that contain a certain string within the slug
- HowTo: Add wrapper to columns shortcode?
- Shortcode Function – Can’t get anything else to return after running shortcode within shortcode
- Custom shortcode with do_shortcode and substr
- Providing fallback function and allow override by plugin
- 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
- Trying to the deduce shortcode from a function
- How to display data from custom fields in my custom shortcode?
- Modify function Shortcode_atts
- Pull random comment from specific post, display on homepage with shortcode
- Run function from parent on child site
- Gallery Shortcode Function Help
- Echo custom field value in shortcode function
- Shortcode Variations?
- shortcode inside post called by ID does not render as expected
- Call ACF data from functions.php [closed]
- 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
- post_content return zero!
- How to make my logged-in user-role shortcode displaying name instead of slug?
- Uploading images via ACF update_field function