Couple things: I think your shortcode function should return the value rather than print it, and you shouldn’t have the output wrapped in braces like that (the one just before the first div, and the one just before the return). Unless that’s some obscure php syntax I’ve never seen (which is entirely possible)?
As far as I know, whenever you close a php tag–even inside a function–the parser will just immediately output the results, not return them.
Related Posts:
- Solution to render Shortcodes in Admin Editor
- Use AJAX in shortcode
- Include PHP file in Content using [shortcode]
- Shortcode producing headers already sent error
- How to add attributes to a shortcode
- How to display random users with avatars
- Enabling shortcodes for custom fields
- How to use get_media_embedded_in_content function
- Can shortcodes contain conditional statements? Even without them my shortcode renders blank page
- Shortcode with parameters inside parameters
- 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
- Display random text from a file with the WP built-in AJAX API
- Set first oembed in post to a global variable or function
- Formatting post content to exclude gallery
- 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
- Adding body class when post contains a specific shortcode
- Function to show only first instance of shortcode
- Display a text message if the shortcode is found?
- creating shortcode to pull json array
- Custom Shortcode, functions PHP WP_Query loop
- Pass Shortcode Attribute to footer Script
- Super simple shortcode not working
- Detect Safari desktop browser and include the detection in a shortcode
- My simple custom shortcode is not longer working (possibly due to upgrade to WordPress 4.4 ?)
- Display gallery on top before content
- List child pages of specific page using shortcode
- How to extract the variables out from “add_shortcode” function?
- Display first name of logged in user?
- How to get specified parent page title in my function
- Possible to display shortcode based on the category?
- WordPress shortcode attributes for database SELECT?
- Shortcode pagination not advancing
- create shortcode to list users with specific meta key value
- Variable if post is sticky in functions.php
- Load templates, pass arguments, and render output from functions.php
- How to add if statement on WordPress shortcode output
- Passing function arguments via a shortcode
- Pagination not working – FrontPage
- Customizing the wp_video_shortcode output with add_filter
- page shows short code not output
- Probleme shortcode with list author
- Function to function shortcode help [closed]
- Last updated posts shortcode in functions.php
- I want to display the sku in the product pages of my EDD website
- 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?
- use add_action in a shortcode (gravity form – WordPress)
- Shortcode displaying outside the div [duplicate]
- Shortcode Initialization in a Custom Theme
- Shortcode with pagination advancing multiple queries
- Show users last read posts for each user?
- Get shortcode attribute value to another function
- How to retrieve image IDs from shortcode content?
- Display list of pages that contain a certain string within the slug
- Hide disclaimer from summary excerpts
- HowTo: Add wrapper to columns shortcode?
- Function not receiving string from shortcode
- How To Show Shortcodes In WordPress Custom Fields?
- Shortcode Function – Can’t get anything else to return after running shortcode within shortcode
- Custom shortcode with do_shortcode and substr
- Shortcode to eliminate and replace with
- Can I use a function to return HTML and the result of another function?
- Problem in outputting shortcode
- 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
- Set thumbnail from URL, by grabbing image in functions.php
- Shortcode to output get_header not working
- restrict access to specific urls on a specific period of time
- using enqueue_script in a shortcode isn’t working
- Run function from parent on child site
- Gallery Shortcode Function Help
- Add title & subtitle to shortcodes
- Echo custom field value in shortcode function
- Shortcode Variations?
- Shortcodes not outputting in correct divs
- shortcode inside post called by ID does not render as expected
- Custom shortcode not being included in content paragraph [duplicate]
- trouble with passing class method data to outside function
- Get term count on a category page
- How do grab the main loop, with conditions, and output via shortcodes
- Display function from functions.php in tag.php
- 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?