Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. add_filter( 'the_content', 'closing_shortcode' );
  2. function closing_shortcode( $content ) {
  3.  
  4. if( !has_shortcode( $content, 'members') )
  5. return $content;
  6.  
  7. $close_shortcode = do_shortcode('[/member]');
  8.  
  9. return $content . $close_shortcode;
  10. }
  11.  
  12. add_filter( 'the_content', 'closing_shortcode' );
  13. function closing_shortcode( $content ) {
  14.  
  15. // return if the shortcode has already been added
  16. // Note the ! was removed
  17. if( has_shortcode( $content, 'members') )
  18. return $content;
  19.  
  20. // Add the closing sortcode tag
  21. $close_shortcode = '[/member]';
  22.  
  23. // and run do_shortcode() on the whole content block
  24. return do_shortcode($content . $close_shortcode);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement