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]
- Stray closing paragraph tag when using shortcodes
- Can You Export Theme Settings From WordPress Multisite?
- Adding Custom Fields to WordPress Comment Forms?
- How to handle valueless attributes in shortcodes?
- How Can A Widget With Only One Instance Be Defined?
- Getting $comments outside the comment template
- get_theme_mod(); returns nothing
- Find and replace domain name on the fly?
- How to change “Dashboard” text in wordpress
- WordPress Template not affecting the working, keeps defaulting to the index.php template
- Custom Widget form function common elements
- Image Editor does not affect custom sizes!
- How to fix the IE9/WordPress Twenty Ten Header Image Display Problem?
- Automatically add image caption with values from a post parent field?
- list/consult Taxonomy only for the respective author/creator in dashbboard
- How to insert a sitemap within a subsite when using WordPress multisite
- Two different inner shortcode under shortcodes or multiple nesting of inner shortcodes
- Child Theme – how to add new widget on a specific place?
- Modify Gallery Output to render differently on a PAGE and a POST
- @font-face is not working in WordPress
- How-To add Custom field in WordPress wp-ecommerce Categories?
- What changes we need to make to a theme so it can be installed as a MU Theme?
- Get Custom Logo Alt Text
- Child theme .css files are not overriding their parent .css files
- One WordPress Installation for 2 Domains
- result from custom filter admin table list backend does not work
- Blog page problems
- Installing new theme on running site
- I’d like to be able to programatically setup a site to discourage crawling by search engines
- dbDelta not creating tables with composite keys
- WordPress Plugin Insert Html Code with Shortcode
- Good way to customize admin CSS?
- Divi theme: change overlay color from default blue to back [closed]
- Add table to WordPress database
- Menu not appearing in custom theme
- failing to display a custom font [closed]
- How to redirect the home page to a custom page?
- Rename Smart YouTube’s httpv back to http for all posts
- Make the home page template my archive/category page template without code duplication
- How to create multipage form and redirect to specific URL based on inpput?
- Simple custom attributes on posts
- Polylang will not allow changing of language without translation
- WordPress 5: including larger thumbnail image sizes in srcset than I have set
- remove screenshot.png via dashboard
- Custom query pagination with php parameter as arg problem
- How to add a static text at end of a wordpress permalink
- How to echo custom styles in css format?
- How to access my WP site locally and publicly? [closed]
- Add date under slider/grid featured content
- How to customize the gallery shortcode in WordPress?
- Using Custom Fields in post, need to put into the_content
- Upload files in wordpress
- Save Option on Database
- What is Global WordPress Objects?
- Using str_replace on wp-admin
- Why should I keep my personal WordPress separate from my “professional” one? [closed]
- How do I include the sidebar (with Widgets) in a custom theme?
- Adding Telescope / Meteor App to existing WordPress site
- Help needed renaming custom post
- User Query Multiple Orderby Clause
- Create a page for each database table entries