As per the shortcode documentation, your shortcode callback recieves any parameters set by the user in a $atts
variable. You can combine them with any default values you might have with shortcode_atts()
.
function newsletter( $atts ) {
$atts = shortcode_atts(
array(
'url' => 'https://domain.com/newsletter/z2o7q6', // change default value as needed
'headline' => 'Newsletter Box Headline', // change default value as needed
'description' => 'Newsletter Box Description', // change default value as needed
),
$atts,
'newsletter'
);
// you can access parameters with $atts['url'], $atts['headline'], and $atts['description']
// e.g <h3><?php echo esc_html($atts['headline']); ?></h3>
}
Related Posts:
- How to customize the default HTML for WordPress Attachments
- How to get shortcode working from custom meta field
- Customizing gallery shortcode in 3.5
- Multiple content areas per page
- Selecting An image from the Media LIbrary on the frontend
- Print shortcode in custom action hook not where the shortcode is entered
- What is the most idiomatic way to let clients edit phrases in HTML?
- shortcodes – style them or change/remove the square brackets?
- Gallery IDS and Captions: hide/show on a per ID basis
- Publishing html directly from ftp to wordpress
- How do I change the markup only of a built-in widget?
- Is it possible to add a ribbon in the background of h1 on every page?
- Edit sticky header html – How to locate corresponding php file
- How can I have a common background color across multiple WordPress blocks?
- Creating a shortcode by pulling in a custom field from a plugin
- “woocommerce_form_field()” function having issues after latest woocommerce update [closed]
- Duplicated content with custom shortcode
- How do I hide an article element so only logged out users see it
- Upload a web module (html and JS) to wordpress
- wordpress shortcode not working
- Where to upload my new custom ShortCode in Separate .php file?
- Custom CSS Nav Menu Style Not Being Applied
- Easily add custom HTML outside the main container?
- Add producthunt badge to wordpress menu
- Display Custom Taxonomy Name As A Shortcode
- how to add custom html and css to wordpress
- wp.blocks.registerBlockType not showing what I want on the frontend
- WP_User_Query Search Multiple Keywords from a Multi-Select Field?
- Local Shortcode Using WordPress Custom Fields
- Move text from the side of image to below image [closed]
- Changing ‘Add to cart’ button text and relink for some specific products [closed]
- WooCommerce – Adding custom HTML to specific product pages
- Accept HTML in custom function
- ACF Shortcode bringing in my shortcode is adding unnecessary line breaks
- How to support extra color options for shortcodes?
- Adding Custom HTML/CSS/JS code in specific page
- Making custom pages (with an example to explain the goal)
- how can i change the html and the css of my word press theme that I bought?
- adding new html css to wordpress section from codepen [closed]
- How to: Easily Move a WordPress Install from Development to Production?
- Is there a flowchart for WordPress loading sequence?
- Essential technical features for high-end WordPress web hosting? [closed]
- How to remove admin menu pages inserted by plugins?
- How to put logs in WordPress
- Conditionally Loading JavaScript/CSS for Shortcodes
- How to get the Date Format and Time Format settings for use in my template?
- Where are Additional CSS files stored
- Best Practices for Regression Testing WordPress Websites?
- Remove wrapping div and ul from output of wp_nav_menu
- What Is The Use Of map_meta_cap Filter?
- get post author id outside loop
- Custom Walker: how to get ID in function start_lvl
- Pass boolean value in shortcode
- How to add crossorigin and integrity to wp_register_style? (Font Awesome 5)
- Creative uses of WordPress [closed]
- How to *remove* a parent theme page template from a child theme?
- How do I make my child theme re-apply the settings that were customised when its parent was active?
- Multiple Inputs in a Customizer Control
- New WP_Customize API – how does it work under the hood?
- Embedding a SOAP Client into a WordPress Plugin?
- Is there anything that Joomla or Drupal can do that can’t be done in WordPress? [closed]
- Update widget form after drag-and-drop (WP save bug)
- Data sanitization: Best Practices with code examples
- How to benchmark a WordPress installation? [closed]
- Should I delete the default themes?
- Moving WP install from local to live, what about wp_posts GUID?
- Modified wp.media.view.Settings.Gallery in Backbone JS, but editing doesn’t work
- Running Gutenberg React in Development Mode
- Prevent WordPress from automatically installing a new theme each year
- Can we use one WordPress installation for multiple databases, domains and content directories
- Is there a blank theme framework compatible with WP 3.0? [closed]
- Plugin SVN & update API – how are plugins identified?
- Users with custom roles not showing in post author select box
- How to use more than 256MB of memory in the admin?
- How do register_sidebar() and get_sidebar() work together?
- How do you get formatted content of a post using the WordPress API?
- Localization: I want the backend: english and frontend in defined language
- Are there any forks of WordPress (and what is different about them)?
- How to Change 404 page title
- Make Custom Metaboxes Collapse by Default
- WordPress Paginate $wpdb->get_results
- Custom maintenance page
- Add button to TinyMCE bar without creating a plugin
- Why do I get the timeout warning?
- How to add a new product type on woocommerce product types? [closed]
- How to include own css on wordpress tinymce editor?
- How to disable page delete
- add button to post edit page when post_status=publish
- how to override woocommerce specific loop or archive-product.php [closed]
- Optimize shortcode callbacks
- Modify existing plugin function using filter (without modifying the plugin directly)
- Rename UPLOADS folder with custom WP_CONTENT_DIR
- WordPress hook before inserting post into database
- Any post install tips after installing WordPress 3.0.1?
- Making Custom Fields Standard in the Admin UI
- Remove WordPress theme from a specific page
- Version Control: Entire site or just pieces?
- Getting a stack trace when an error occurs?
- Check for and enforce unique value in user-entered custom meta field in WP Admin
- Backup the Database and Restore from the Backup?