731 posts
  • Elite Author
  • Attended a Community Meetup
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Bought between 50 and 99 items
  • Exclusive Author
  • Most Wanted Bounty Winner
+2 more
mordauk says

Do I have to change “the_content” to something else to make it work?
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
add_filter( 'the_content', 'shortcode_unautop',100 );

Using [raw] short codes is fine. Removing these filters is absolutely not fine. Doing so causes huge problems for a lot of plugins.

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says
Have you read my problem? My RAW -tags do not work with shortcodes I’ve implemented like
do_shortcode(ot_get_option( 'textbox1' ));

(With ot_get_option I get the content of a textbox from the theme options)

145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

Hm I really don’t find somehting about it on the www.

4301 posts ThemeForest Reviewer
  • Envato Staff
  • Reviewer
  • Community Moderator
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Venezuela
  • Has been a member for 5-6 years
  • Envato Studio (Microlancer) Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
+9 more
Ivor Reviewer says


Do I have to change “the_content” to something else to make it work?
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
add_filter( 'the_content', 'shortcode_unautop',100 );
Using [raw] short codes is fine. Removing these filters is absolutely not fine. Doing so causes huge problems for a lot of plugins.

No worries now Pippin, we’re not approving themes if they’re stripping out native functionalities.

@LovelessDesign http://wordpress.org/extend/plugins/shortcode-empty-paragraph-fix/

57 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Has been a member for 3-4 years
  • Europe
  • Referred between 10 and 49 users
  • Bought between 10 and 49 items
maarcin says



Do I have to change “the_content” to something else to make it work?
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
add_filter( 'the_content', 'shortcode_unautop',100 );
Using [raw] short codes is fine. Removing these filters is absolutely not fine. Doing so causes huge problems for a lot of plugins.

No worries now Pippin, we’re not approving themes if they’re stripping out native functionalities.

@LovelessDesign http://wordpress.org/extend/plugins/shortcode-empty-paragraph-fix/

Thank You for this.

3414 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 100 and 499 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer moderator says

@LovelessDesign http://wordpress.org/extend/plugins/shortcode-empty-paragraph-fix/

Wow, does this really resolve all cases? That’d be cool :)

    add_filter('the_content', 'shortcode_empty_paragraph_fix');
    function shortcode_empty_paragraph_fix($content)
    {   
        $array = array (
            '<p>[' => '[', 
            ']</p>' => ']', 
            ']<br />' => ']'
        );

        $content = strtr($content, $array);

        return $content;
    }
145 posts
  • Austria
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
LovelessDesign says

This plugin does also NOT remove P-Tags for shortcodes I’ve implemented like

do_shortcode(ot_get_option( 'textbox1' ));
I need this kind of implementation because I want to use shortcodes in Theme Options Text boxes.



EDIT : Ok this would work, but isn’t there a nicer solution?

do_shortcode(shortcode_empty_paragraph_fix(ot_get_option( 'fp_textbox' )));

490 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 more
pixelentity says

Wow, does this really resolve all cases? That’d be cool :)
    add_filter('the_content', 'shortcode_empty_paragraph_fix');
    function shortcode_empty_paragraph_fix($content)
    {   
        $array = array (
            '<p>[' => '[', 
            ']</p>' => ']', 
            ']<br />' => ']'
        );

        $content = strtr($content, $array);

        return $content;
    }

yes but still there’s a major issue: it gets applied to all shortcodes, including those defined in 3rd party plugins (which is bad).

just spent some time on this, and replaced the above with some regexps:

https://gist.github.com/3776987

It basically works the same way but only on your blocklevel shortcodes defined in the array (“col” in the example)

BF

101 posts
  • Elite Author
  • Referred between 100 and 199 users
  • Bought between 1 and 9 items
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
PixelBook says

yes but still there’s a major issue: it gets applied to all shortcodes, including those defined in 3rd party plugins (which is bad).

just spent some time on this, and replaced the above with some regexps:

https://gist.github.com/3776987

It basically works the same way but only on your blocklevel shortcodes defined in the array (“col” in the example)

BF

care to share the full code. did you add it in a filter function?

100 posts
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 500 and 999 users
  • Sold between 250 000 and 1 000 000 dollars
  • United States
StevenGliebe says

For what it’s worth, I had been following misguided advice from tutorials that should be taken offline before I ran across this old but useful post by Viper007Bond: http://www.viper007bond.com/2009/11/22/wordpress-code-earlier-shortcodes/

Preprocessing shortcodes that output user-supplied content end up showing correctly without all the annoying paragraph and break formatting issues while third-party plugin shortcodes continue to function normally. I only implemented this recently and so far so good. Anybody have a reason that this is not a good solution?

by
by
by
by
by
by