Try not to use capital letters in the shortcode attributes, use for example
[wi_form product_name="php" product_price="888" ]
where:
add_shortcode( 'wi_form' , 'wi_form_func' );
function wi_form_func($input) {
extract(shortcode_atts( array(
'product_name' => 'Java',
'product_price' => 1000
), $input));
return $product_name . esc_attr( $product_price );
}
or this:
add_shortcode( 'wi_form' , 'wi_form_func' );
function wi_form_func($input) {
$input = shortcode_atts( array(
'product_name' => 'Java',
'product_price' => 1000
), $input );
return $input['product_name'] . esc_attr( $input['product_price'] );
}
if you don’t want to use extract
:
Update:
The shortcode attributes go through strtolower()
in the shortcode_parse_atts()
function that retrieves them from the shortcode tag (see here).
Related Posts:
- How to customise the output of the WP image gallery shortcode from a plugin?
- Custom media upload content for inserting custom post shortcode
- Checking if an attribute exists in a shortcode
- All shortcodes not working on custom theme
- enqueue script only if it is not already enqueue
- Shortcode output appears before post body [duplicate]
- PHP Deprecated: Non-static method should not be called statically
- How to parse nested shortcodes?
- How to call shortcode function directly and pass $atts
- How to pass multiple values in shortcode?
- change plugin shortcode function [closed]
- Calling function from within functions.php returns unwanted value
- plugin shortcodes not working on custom theme- unsure how to fix
- Dynamic HTML not displaying at respective place
- Plugin form unable to process
- Short code for Venues
- Frontend editing, Frontend user dashboard
- Can’t get custom posts of taxonomy to show
- Shortcode doesn’t work if I directly paste its function in a template file?
- May i Use ShortCode in Template?
- Pass variable to nested shortcode
- Add custom variable in Contact Form 7 mail body
- get shortcode value
- Storing Options in a Shortcode
- Prevent shortcode from being wrapped in tags
- How can I create a custom shortcode that will return a custom post type by ID?
- Plugin Handle URL With Custom Theme
- AddToAny shortcode in the loop
- How to add an automatic refresh in WordPress for a Page/Post or an embedded OneDrive/Excel HTML Code?
- How to fix wrong attribute error for Visual Composer Grid Builder?
- Making a Template for a CPT created by a plugin
- Shortcode Plugin to dynamically build a shortcode via `do_shortcode` not working
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- accessing wp.media api from a tinymce plugin
- Creating shortcodes in plugin
- Visual Composer shortcode for child theme dir
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Create shortcode to echo javascript
- Redirect to another page using contact form 7? [closed]
- My plugin won’t return anything [closed]
- Shortcode to update user meta
- Why shortcode always displayed after footer not in body
- Why am I unable to load scripts in head in plugin?
- Deactivate JS Script in Plugin Shortcode
- Where to find the code used to render a page that has a shortcode and a template defined?
- Shortcode not working after move wordpress website files
- convert more tag to shortcode
- Shortcode does not expand in Facebook like
- Plugin that provides the [edit] shortcode?
- Return multiple values in a shortcode attribute
- How to change shortcode’s default theme?
- Override/ignore CSS from active theme as not to interfere with my custom CSS
- Is there a way to convert shortcodes to html content?
- How to use template inside plugin shortcode with variables for big HTML code
- Loop returns the current page’s permalink and guid instead of the post in the loop
- How to rewrite URL and get the values?
- How to prevent tabs from opening all at once
- Executing Javascript in Plugin
- Shortcode and variable
- How can I achieve this, using shortcodes
- Elementor Pro display featured image on section -> style -> image using shortcode
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- How To Use do_shortcode with WooCommerce One Page Checkout
- How to get current cart values using WC_Shortcodes?
- Can I add Short Code Of A Plugin In The Code Editor of WordPress?
- insert og image link in wordpress post
- How to check if short code is present in template?
- Shortcode show error while editing post
- Get Shortcode output to database for static post_content
- Issue Saving Posts That Contain Shortcode
- Using Shortcode Result In Custom HTML Block (Using Google Sheet JQuery Result As NumScroller data-max)
- How to use plugin’s shortcode in custom design? [closed]
- WordPress show descriptions under images in gallery
- WP Plugin CSS not being applied to page
- Modify Plugin PHP Class in Child Theme – Correct Method
- How to add HTML to a template only when user is logged out/ not registered
- Multiple calling javascript from shortcode in one page
- How to pass value to a plugins shortcode?
- Is it possible to get a shortcode generated by a plugin, then, using a function, create a new post using that shortcode?
- Find all strings between an enclosing shortcode
- Hide some shortcodes on posts from back-end
- Trouble implementing python on WordPress
- Is there a function to search for a wildcard value when calling a shortcode?
- How to display single arbitrary facebook post with a shortcode?
- Multiple level shortcodes
- Custom shortcode with dynamic rewrite
- Posting code inside the post instead of in the template file using shortcode
- apply_filters to content but ignore shortcodes
- How to load a plugin when doing an Ajax call? [duplicate]
- Is it right way to create shortcode?
- Trying to override/intercept a PhotoMosaic gallery link in WordPress using jQuery
- Trying to Understand Shortcodes.
- Creating Features List in WordPress Post
- I am experiencing difficulty fulfilling client request
- cURL External API request displays content above other content on page
- Subtract Using GravityWP Count Plugin
- qTranslate‑X is not translating all shortcodes
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- Problem with a shortcode generating a error [closed]