To insert code in a forum thread or comment wrap it in code tags: <code>...</code>.
Disable Automatic p tags
  • Hello,

    I am trying to disable the automatic adding of p tags....

    I tried adding : <?php remove_filter (‘the_content’, ‘wpautop’); ?>

    to my page template php files (full width, ect files)

    as described on this page: http://www.thewebsiteprofessionals.com/wordpress-paragraph-tags.html

    However that did not help....

    any idea?

    thanks!
  • 4 Comments sorted by
  • OK .. I have investigated this for awhile now, and it has to do with something about this theme...


    when I change to the default theme, it doesnt add 'p' tags... but this theme does.


    The reason I need to stop WP from automatically adding these tags is because I have a script I need to add in the content area, and its adding 'p' tags all over it.

    As soon as I switch to the default theme, the 'p' tags are gone and the script works.

    I even tried this plugin to disable 'p' tags, and it still didnt work in this theme : http://urbangiraffe.com/plugins/disable-wpautop/

    Any help would be great!!

    Thanks!
  • I may be wrong here, but I believe that Kaptinlin defines his own wpautop. Also could be an issue of priority, in a theme as complicated as Striking and using add_filter and remove_filter, weird issues can occur relating to the priority - default is 10. Check out the codex for remove_filter
  • Hi,

    In 'striking/framework/functions/shortcodes/typography.php'

    You will see the code below

    /**
    * Disable Automatic Formatting on Posts
    * Thanks to TheBinaryPenguin (http://wordpress.org/support/topic/plugin-remove-wpautop-wptexturize-with-a-shortcode)
    */
    function theme_formatter($content) {
    $new_content = '';
    $pattern_full = '{(\[raw\].*?\[/raw\])}is';
    $pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
    $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);

    foreach ($pieces as $piece) {
    if (preg_match($pattern_contents, $piece, $matches)) {
    $new_content .= $matches[1];
    } else {
    $new_content .= wptexturize(wpautop($piece));
    }
    }

    return $new_content;
    }
    remove_filter('the_content', 'wpautop');
    remove_filter('the_content', 'wptexturize');


    This will cause the issue.

    If you don't want wpautop the code,
    You can edit on line 16.

    Change it to

    $new_content .= wptexturize($piece);

    Regards,
    KaptinLin
  • Genius!!!! the script now works!!!


    Thanks!!
This discussion has been closed.
All Discussions