Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'the_content', 'closing_shortcode' );
- function closing_shortcode( $content ) {
- if( !has_shortcode( $content, 'members') )
- return $content;
- $close_shortcode = do_shortcode('[/member]');
- return $content . $close_shortcode;
- }
- add_filter( 'the_content', 'closing_shortcode' );
- function closing_shortcode( $content ) {
- // return if the shortcode has already been added
- // Note the ! was removed
- if( has_shortcode( $content, 'members') )
- return $content;
- // Add the closing sortcode tag
- $close_shortcode = '[/member]';
- // and run do_shortcode() on the whole content block
- return do_shortcode($content . $close_shortcode);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement