Your syntax is broken, the quote marks do not match. Try to separate data from the shortcode template, and use sprintf()
:
$shortcode = sprintf(
'[pw_map address="%1$s %2$s %3$s %4$s" width="%5$s" height="200px"]',
$address,
$city,
$province,
$postalcode,
'100%'
);
echo do_shortcode( $shortcode );
That’s much easier to read, and it is harder to create syntax errors. 🙂
Related Posts:
- How to create a shortcode with 1 parameter (atts)
- shortcodes output before content [duplicate]
- How does a shortcode work?
- Remove wptexturize from a shortcode?
- WordPress adds br in between my shortcode
- Shortcodes, HTML tables, and multiple rows
- WP_enqueue_script inside shortcode?
- Shortcode to Gutenberg-block: additional text on front-end and conditional display
- template_redirect to accompany with a shortcode
- How navigation works in custom loop within shortcode?
- Use [shortcode=”value”] instead of [shortcode att=”value”]?
- Tinymce shortcodes within shortcode contents
- I dont want to show shortcode in tag
- How do I preview the result of a shortcode in the TinyMCE editor?
- WordPress shortcode doesn’t working on HomePage
- Font Awesome Icons Won’t Work
- How to Get a part of URL and put in shortcode?
- Get shortcode attribute outside of WordPress
- Overriding shortcode $atts for featured products
- Shortcode for Twitter Bootstrap Collapse
- Is there any inherent difference between add_filter() and add_shortcode() for modifying [caption]?
- get_shortcode_regex() only matches first shortcode
- Looking for a way to include/embed text from a file on a page so that the short codes are processed
- How do I debug a short code?
- How to type shortcode-like text in WordPress TinyMCE visual editor?
- Does registering multiple shortcodes impact performance?
- How can I hide the Permalink/Shortlink for certain user logged in Users of a certain level?
- How to force that styles are enqueued in the header?
- add action only if gallery shortcode attribute is equal to?
- How To Conditionally Include A Short Code Depending On The HTTP_REFERER [closed]
- Shortcode for order number [closed]
- Create shortcode in WordPress, using one variable in 3 functions?
- Adding javascript actions to words in post content
- My shortcode does not call the function
- Shortcode not showing anything
- Hide Selection of Text From Archive, but Show on Single Posts
- How to create an incremental list using shortcodes?
- Displaying shortcode output through Options Framework
- How to Generate html tags using shortcodes?
- Do shortcode that is inserted in a textarea is not displaying properly
- How to Make Archive ShortCode
- Adding custom form within add_shortcode
- Are Shortcode Attributes Always Passed As Strings?
- wp_editor not rendering the shortcode
- Default WordPress shortcodes not working?
- how to add shortcode in wordpress container [duplicate]
- How to make this shortcode work for post content wordpress [duplicate]
- Get array of shortcodes within string
- stop WordPress removing shortcode from content [closed]
- caption shortcode using image alt as caption
- Sanitize or treatment of string in editor via shortcode
- Is it possible to handle two or more shortcodes in a single page?
- Toggle Shortcode Sanitize Title
- Clearfix Shortcode
- How and when to include shortcode source files
- Use full size images in a specific gallery
- how to create a fav icon shortcode?
- How to deal with WordPress bug: can’t use wrapped and unwrapped shortcode on same post
- Execute Shortcodes when submitting post
- Substituting value via shortcode
- Video shortcode, option are not rendered
- Create shortcode for each form field in contact form 7
- Can’t render shortcode when html tag contains hyphen
- Auto embeds don’t work for attachment descriptions
- Shortcode to appear and show the date not code in Title and description of Social Media sites
- Not to escape a text
- Date Shortcode in Image alt and title tags
- access shortcode atts in template part
- how to add shortcode widget at end of main blog page
- Shortcode result appears above page content
- Shortcode is not showing content when placed in editor (post_type = page)
- How to set up posts per page on WP
- How to insert a short code into Contact Form 7 in WordPress that will call a function once the submit button is pressed
- Unable to make shortcode, what is wrong?
- Multiple shortcodes only use attributes from one of the shortcodes on custom plugin
- Cannot modify class property from shortcode handler function
- How to display a page dependent on a url parameter supplied by a form/button page?
- How do i remove Business feeds Shortcode fatal error
- Can’t place endwhile in the loop properly in a shortcode
- How to reduce the image size inside an icon? [closed]
- Push Shortcode parameter to template
- latest posts shortcode with image
- Shortcode tags appear on mobile themes
- WordPress Gallery with ID’s Shortcode not Working
- Featured image with link to post shortcode, image displaying above the post
- Video shortcode inside tabs shorcode NOT working
- How to stop unwanted splits in excerpts when using shortcodes for sliders or players
- How to add meta slider lite or other slider to main page header in pinboard theme
- Str_replace using shortcode with multiple changes
- Escaping a shortcode so it displays as-is [duplicate]
- WordPress do_shortcode first iteration
- If do_shortcode is blank, return some message
- Add a short code to a plugin
- echo a shortcode in a shortcode code?
- Applying if (get_post_meta) to new shortcode
- Add widget/shortcode to sidebar OUTSIDE of the theme
- How to remove https:// from shortcode generated url
- How to enable on custom shortcodes
- I have the query code but not the shortcode
- wordpress how to sort posts on custom data with plug-in “Search & Filter”