WordPress.org

Support

Support » How-To and Troubleshooting » paragraph tags wrapping text widget

paragraph tags wrapping text widget

  • How do I get the text widget to stop wrapping the entire thing in a p tag.

    This doesn’t work….
    remove_filter( ‘the_content’, ‘wpautop’ );
    remove_filter(‘the_excerpt’, ‘wpautop’);

Viewing 15 replies - 1 through 15 (of 23 total)
  • Moderator kmessinger

    @kmessinger

    Forum Moderator

    Text widgets only add p tags if you have that option checked.

    I’ve tried it both ways. I’m not talking about p tags with in the text its self. I’m talking about the set that’s added around everything.

    I finally got a hack to work by finding the filter in default-widgets.php and hacking it out. But I’d prefer that to be a temporary solution.

    esmi

    @esmi

    Forum Moderator

    Never, EVER, edit core WordPress files! It is actually your theme that controls what markup is being used with all widgets. Try looking in there.

    If you are referring to before_widget and after_widget from the register_sidebar functions that is not where the p tag is coming from. Its not coming from the template files either. And I don’t see anything else in my theme that would be adding this tag in.

    And please no doom and gloom about editing core files. The world will not stop spinning because I did. 😉 If wordpress wants us to leave the core alone then they need to stop doing stuff like having out of control p tags.

    esmi

    @esmi

    Forum Moderator

    I’ve created about 50-60 themes and I didn’t have this problem in any of them. This is not a WordPress core issue.

    Ok. I’m using the Simon WP Framework theme. Where do you suggested I look to turn this feature off?

    Simon WP Framework

    Moderator kmessinger

    @kmessinger

    Forum Moderator

    Have you submitted your question to the theme developer?

    I have not. I’ve read every line of code in the theme. There is no setting in there for this. Now….if this is something that is on by default in the wordpress core that needs to be turned off in the theme that’s a different story….

    esmi

    @esmi

    Forum Moderator

    There isn’t anything you can turn off in WordPress core. This is being added by your theme.

    Then why does forum after forum say to use these lines of code in the theme to turn off wpautop?

    remove_filter( ‘the_content’, ‘wpautop’ );
    remove_filter(‘the_excerpt’, ‘wpautop’);

    Obviously there are things in core that can be turned off. Even the documentation on this site talks about turning it off.
    http://codex.wordpress.org/Function_Reference/wpautop

    esmi

    @esmi

    Forum Moderator

    That has nothing to do with widgets. That relates to the WordPress editors for Post & Page content

    Well….I know that different functions to call text from posts or page content will automatically apply different filters. Are there different functions that call widgets too?

    esmi

    @esmi

    Forum Moderator

    The function that calls the widgets is dynamic_sidebar.

    yep….that’s the one I’m using. And it doesn’t look like there are any paramaters to turn on or off filters for a widget. Same with registering register_sidebars. So if that’s the case…..then where in the theme could there possibly be code that would be telling it to wrap the whole text-widget in p tags?

    esmi

    @esmi

    Forum Moderator

    Try looking in the file where your theme registers widgets – usually functions.php

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘paragraph tags wrapping text widget’ is closed to new replies.