Shortcode Attributes Code Overview Use this tool to create custom code for Shortcodes with add_shortcode() function. Usage Fill in the user-friendly form. Click the “Update Code” button. Copy the code to your project. Or save it as a snippet and share with the community. Examples If you are still learning how to use this tool, check out the following examples: [video_embed src=”” width=”” height=””] [img width=”” height=””] http://… [/img] [b] bold text [/b] [link-to-post id=””] [recent-posts posts=”5″] [cloak email=”[email protected]”] Tag Name Shortcode tag in the content. e.g. [tag] Function Name The function used in the code. Shortcode Type Enclosing Self-closing Self-closing shortcode: [tag] Enclosing shortcode: [tag]content[/tag] Attributes Yes No Enable attributes such as [tag foo="123" bar="456"]. Add Attributes Filter No filter (Default) Yes - Use tag name (Recomended) Yes - Use custom name Use "shortcode_atts_{$shortcode}" filter, to allow shortcode attributes filtering. Custom Filter Name Set custom filter name. 1st Attribute Name Attribute name. Lowercase. 1st Attribute Default Value Default value. e.g. [tag attr_name="default_value"] 2nd Attribute Name Attribute name. Lowercase. 2nd Attribute Default Value Default value. 3rd Attribute Name Attribute name. Lowercase. 3rd Attribute Default Value Default value. Code return '<strong>' . $content . '</strong>'; Custom code to generate the output.Should only "return" the text, never produce the output directly. Update Code Save Snippet
// Add Shortcode function blod_text_shortcode( $atts , $content = null ) { return '<strong>' . $content . '</strong>'; } add_shortcode( 'b', 'blod_text_shortcode' );