To encode the URL, you could use the PHP urlencode( $url )
function or use the WordPress urlencode_deep( $array | $str );
function.
add_shortcode( 'dynamic_contact_button', 'button_product_page' );
function button_product_page() {
global $product;
return urlencode( "https://wordpress.stackexchange.com/contact-form/?products=Product:%20" .$product->get_title(). "&#contact_form" );
}
links:
Related Posts:
- Colon is Missing In My Website Url in WordPress
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- Need to Echo A Url path to show on a wordpress page
- Whats wrong with my code? Need To add String to shortcode? [closed]
- How to get URL of current page displayed?
- How do I use Shortcodes inside of HTML tags?
- Dynamic URL to reference custom PHP files
- WordPress Shortcode and Dynamic CSS
- Creating a WordPress shortcode
- has_shortcode() – how to detect nested shortcode
- How to return multiples lines in a shortcode?
- Newbie question: no index.php? in my plain wordpress permalink
- How do I turn a shortcode into PHP code?
- How to return a foreach inside a shortcode
- Placing raw HTML inside a WordPress shortcode
- Shortcode content output but not in correct place
- PHP code inside shortcodes
- How to display posts by current user in a drop down
- Pass php dynamic variable to shortcode
- wordpress 4.4 self hosted video (html5) doesn’t show
- do_shortcode with custom field
- Remove echo from shortcode
- Get URL Parameters from referer
- Shortcode to show the code
- Get the URL of the page from which an ajax request has been launched within ajax callback
- get_posts works in the page template but not in a shortcode
- How can I include shortcodes within PHP?
- $wpdb returns duplicate posts
- Syntax error in a shortcode function
- Shortcode to find and replace URL
- How to put a form with php code into a variable or shortcode?
- Help with WordPress function inside a shortcode
- Short code template + ajax
- WordPress shortcode returns the data before
- Shortcode to embed Edit Account form not working
- Handling PHP/HTML inside the output of a shortcode function
- I’m unable to call img path using single quotes in an array?
- Split shortcodes to array of shortcodes
- PHP error with a shortcode: “no suitable wrapper” for file_get_contents
- How to make a conditional statement within $output in shortcodes.php?
- Call featured image url
- Shortcode for a Series of Elevating Image Files, Excluding a Range?
- Shortcode won’t execute
- Use an anchor link to open an iframe inside a WordPress page
- Adding custom url to readmore link using get_permalink()
- How to set base url for php widget
- Shortcode displaying at the top of the page [duplicate]
- AJAX function not working [closed]
- Modifying WP URL handing code?
- How to deal with a GET variable of ‘name’?
- Can ‘Custom Field’ data be inserted into this Short Code?
- Why wp_remote_get() fetches certain web pages while it doesn’t work for my localhost?
- How to exclude labels from certain categories in a shortcode?
- Set document title through shortcode plugin
- Trying to call dynamic content into a 3rd party shortcode
- Unable to display multiple parameters from url by javascript through shortcodes
- Get nice name of category from slug (remove dashes of category)
- Shortcode in Shortcode/HTML Graphics and Pictures
- Why is the current page loaded in the pop-up window and not the specified one?
- How to search order using database frontend short code WordPress
- How do I reopen the (Popup Maker) after entering the correct password for a password protected page?
- Not able to remove caption shortcode from the content
- How to add a shortcode which runs a .php file for the current post
- Block error message in foreach loop when looping through ACF field
- PHP multiple forms, same page, isset($_POST[]) not working?
- Shortcodes not processing inside post content
- Gravity Forms: How to add PHP function to confirmation conditional shortcode?
- wpdb->query returns different value to phpMyAdmin
- shortcodes, custom php and their errors
- Current WordPress Page Title as Search Parameter into A Tag
- I want to hide “sold by” on certain pages with id page 43
- How to add a PHP scripts into WordPress
- How does one make a URL return dynamic JSON with custom Content Type?
- Why my Ajax events are no longer detected after dynamic change of shortcode content
- Multiple Arrays for Custom Post Query using Boostrap accordions and ACF repeater fields
- Replacing entire tag with shortcode – JavaScript [duplicate]
- Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment
- Shortcode just with a php code
- Strange special character/Latin characters
- changing static link to relative link
- Custom fields changes the formatting of metabox input
- Shortcode is not outputting all of the desired markup
- Create a dynamic buddupress tab
- Contact form field in wordpress menu
- Serializing URL via wp add_shortcode to auto select from option list onload
- php string inside shortcode does not work
- Limit the number of successful logins
- Shortcodes (with a space) added to php Sample
- Show contact 7 form in popup
- How can I put a custom field as the link of a button shortcode?
- Magento and WordPress URL integration [closed]
- Custom field within shortcode
- How to remove parent section in an attachment URL in wordpress?
- Problem using explode inside add_shortcode() callback funciton [closed]
- Display Current Time using shortcode
- Set variable in javascript and using in my shortcode
- How to create shortcode of this PHP code
- Create a custom plugin with dynamic child pages listing database records
- How to edit a widget code?
- wordpress shortcode url decode non Latin character