737 posts
  • Has referred 1000+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Became a Top 20 Author of the Month
+9 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
  • Has been part of the Envato Community for over 2 years
  • Located in Austria
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
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
  • Has been part of the Envato Community for over 2 years
  • Located in Austria
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
LovelessDesign
says

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

4477 posts ThemeForest Senior Reviewer
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Member of the Envato Team
+14 more
Ivor
Envato team
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/

63 posts
  • Has referred 10+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+3 more
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.

3535 posts
  • Power Elite Author: Sold more than $1M on Envato Market
  • Has sold $1M+ on Envato Market and is now a Power Elite Author
  • Had an item that was trending
  • Located in United States
+13 more
sevenspark
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
  • Has been part of the Envato Community for over 2 years
  • Located in Austria
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
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' )));

501 posts
  • Has referred 1000+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Became a Top 20 Author of the Month
+10 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
  • Had an item that became a weekly top seller
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 100+ members
+3 more
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?

118 posts
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
+6 more
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