It’s a bit difficult to understand or provide an accurate answer as we don’t know what the shortcode is executing. Is it stripping html or any other parsing?
If this is your own code, then you could add it in the function the shortcode is calling.
If its not you could try a couple options:
1: (adding the div directly into the shortcode call)
<?php echo do_shortcode( '[shortcode]<div>'.$var.'</div>[/shortcode]'), ; ?>
2: add it to the $var
first:
<?php
$dvar="<div class="own">".$var.'</div>';
echo do_shortcode('[shortcode]'.$dvar.'[/shortcode]');
?>
Again, the ideal solution would be to see that function and then put the div directly in before the shortcode is executed.
Related Posts:
- Using get_option() in JavaScript
- Shortcode empty attribute
- Using wp_editor in shortcode
- Why are you using add_action for shortcode?
- How to get URL param to shortcode?
- How can I put a wp_redirect into a shortcode?
- How to display the names of users from a specific group with a shortcode?
- shortcode for logo image
- Using audio shortcode for .mp3 URLs with a query string
- Get multiple shortcode attribute values
- Why do_shortcode is not executing the shortcode in data-* html attributes?
- How to display some selected user meta data on a specific page with a shortcode?
- Gallery shortcode menu order fix no longer working on WordPress 4.0
- has_shortcode for content added after the content
- Shortcode displays only default attribute values
- Can a shortcode function this way
- Creating a Slider Shortcode Based on Nivo Slider
- Passing attributes to shortcode dynamically
- Stop parsing shortcodes
- WordPress auto adds p to shortcode parameters
- Why isn’t this youtube shortcode working?
- Gist shortcode is not working
- Enclosing Shortcode Within Another Enclosing Shortcode Breaks Output Functionality
- Register visits of my pages in wordpresss
- Is it possible to ignore the first Line Break in a preformatted Div from a shortcode?
- Video shortcode – autoplay all videos
- List monthy archives for specific year with wp_get_archives
- How can I included CSS to a page or a shortcode? [closed]
- Two Shortcodes in one page not working
- Shortcode not working on static front page
- Call Shortcode inside another Shortcodes callback
- Creating a shortcode in a plugin that includes JS
- Compatibility of MathJax extension and JetPack [closed]
- Shortcode to delete post from front end
- How to parse shortcodes within returned content
- Hook WP_Embed run_shortcode
- Get Required Assets (JS, CSS etc) for post using REST API
- shortcode in snippet plugin not work
- AJAX and Shortcode with Parameters
- Detecting embeded video format
- While loop shortcode problem
- How to prevent shortcode preview from breaking in tinymce editor?
- Execute Closing Shortcode After the_content
- Forcing max-width for image captions
- Responsive Embeds using default embed shortcode
- problem with shortcodes nesting
- OOP and WordPress shortcode
- Is it possible to modify the header with a content shortcode?
- Convert my php code into shortcode
- Custom shortcode breaks my page
- Shortcode is not working
- Custom shortcode is causing a WSOD
- this simple shortcode doesn’t generate Collapse as supposed
- Shortcode outputting at top of content
- Why can’t I display attachment_image_src with Custom Size?
- Get attributes of nested shortcodes
- How to create a shortcode to let the user add the ID of a YouTube video?
- How do I define and register a shortcode function in a namespaced functions.php file?
- A shortcode nested inside a shortcode
- How to add shortcode to html widget
- Implementing a URL Shortener
- Custom Shortcode + Querying and Ordering Posts using multiple Advanced Custom checkboxes
- Add div on EMED Tag
- Clean way of using ob_start() and ob_end_clean() in wordpress
- Theme Convert PHP code to shortcode
- call other shortcode in the email contactform7 send [closed]
- find shortcode inside content of post
- WordPress Short code for List style
- Putting a space between the buttons [closed]
- Processing a login/register form before shortcodes are rendered?
- Adding a cover image to video shortcode
- Insert First Image into post (full-width)
- Show content if user left comment / non-logged visitors?
- How to insert current user ID/entry ID into a shortcode?
- How to display html element and php string in the same line?
- Using a WP shortcode in Homepage
- i want to show a modal when user lands on home page very first time
- Shortcode not working in Jetpack Top Posts & Pages widget
- Restricting shortcode for users
- Shortcode, vs blocks, vs templates – what would you do for choosing or creating custom post data in editor?
- create shortcode that changes url endpoint
- Logout user if click on a custom page link
- Convert WordPress shortcodes into plain html
- Attributes are not passed on nested shortcode
- How to make a shortcode with a line break in it parse correctly?
- Removing text + shortcode from all posts
- Is Post-Author-Id shortocde
- Load next post by ID on a single page
- Add catagory attribute to custom shortcode
- Access the resized images generated by `add_image_size()`
- Class variables in shortcodes
- Defining the output of a WordPress Att
- Custom WP theme not showing shortcodes
- Shortcode for sectors
- How to not show shortcode contents if cart is empty?
- A number appears inside a div called wpb_wrapper, when I use a custom shortcode
- Enclose article’s body with default shortcode
- Shortcode with foreach
- Why does my shortcode query not working with search term
- How to use multiple values in “Shortcode”? [closed]