WordPress.org

Ready to get started?Download WordPress

Forums

paragraph tags wrapping text widget (24 posts)

  1. graftedin
    Member
    Posted 8 months ago #

    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');

  2. kmessinger
    Volunteer Moderator
    Posted 8 months ago #

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

  3. graftedin
    Member
    Posted 8 months ago #

    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.

  4. esmi
    Forum Moderator
    Posted 8 months ago #

    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.

  5. graftedin
    Member
    Posted 8 months ago #

    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.

  6. esmi
    Forum Moderator
    Posted 8 months ago #

    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.

  7. graftedin
    Member
    Posted 8 months ago #

    Ok. I'm using the Simon WP Framework theme. Where do you suggested I look to turn this feature off?
    http://simonwebdesign.com/simon-wp-framework/

  8. kmessinger
    Volunteer Moderator
    Posted 8 months ago #

    Have you submitted your question to the theme developer?

  9. graftedin
    Member
    Posted 8 months ago #

    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....

  10. esmi
    Forum Moderator
    Posted 8 months ago #

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

  11. graftedin
    Member
    Posted 8 months ago #

    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

  12. esmi
    Forum Moderator
    Posted 8 months ago #

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

  13. graftedin
    Member
    Posted 8 months ago #

    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?

  14. esmi
    Forum Moderator
    Posted 8 months ago #

    The function that calls the widgets is dynamic_sidebar.

  15. graftedin
    Member
    Posted 8 months ago #

    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?

  16. esmi
    Forum Moderator
    Posted 8 months ago #

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

  17. graftedin
    Member
    Posted 8 months ago #

    Sorry, its using register_sidebar instead. But still no paramaters

  18. graftedin
    Member
    Posted 8 months ago #

    yep. i've done that. anyway to post that file here so you can see it? Or maybe you want to download the whole thing.
    http://simonwebdesign.com/simon-wp-framework/

  19. esmi
    Forum Moderator
    Posted 8 months ago #

    Can you just post the register_sidebars function here?

  20. graftedin
    Member
    Posted 8 months ago #

    function simonwpframework_widgets_init() {
    	register_sidebar(array(
    		'id' => 'main-sidebar',
    		'name' => 'Main Sidebar',
    		'before_widget' => '<div class="flex_100">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    	register_sidebar(array(
    		'id' => 'footer-1',
    		'name' => 'Footer1',
    		'before_widget' => '<div class="flex_33">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    	register_sidebar(array(
    		'id' => 'footer-2',
    		'name' => 'Footer2',
    		'before_widget' => '<div class="flex_33">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    	register_sidebar(array(
    		'id' => 'footer-3',
    		'name' => 'Footer3',
    		'before_widget' => '<div class="flex_33">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    }
    add_action ( 'widgets_init', 'simonwpframework_widgets_init' );
  21. esmi
    Forum Moderator
    Posted 8 months ago #

    No p tags being added in there.

  22. graftedin
    Member
    Posted 8 months ago #

    Correct...not through that code BUT when the page is rendered there are p tags being added inside the wrapping div tags and around the text inside the div tags.

  23. esmi
    Forum Moderator
    Posted 8 months ago #

    OK - let's try another approach...can you replicate the problem using the default Twenty Thirteen theme with all plugins deactivated?

  24. graftedin
    Member
    Posted 8 months ago #

    Well that was very interesting.......... I had a plugin called Shortcodes Ultimate installed that replaced the wpautop filter with its own so that p's don't get added around short codes. !@#$!@#$!!!!!!!

Reply

You must log in to post.

About this Topic

Tags

No tags yet.