Wordpress Self-Closing Shortcode


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // FOR THE FUNCTIONS.PHP FILE >>
  2.  
  3. function do_my_shortcode( $atts, $content = null ) {
  4. return '<div class="something">' . $content . '</div>';
  5. }
  6. add_shortcode('shortcode_label', 'do_my_shortcode');
  7.  
  8.  
  9.  
  10. // TO USE THE SHORTCODE >>
  11.  
  12. [shortcode_label]My Caption[/shortcode_label]

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.