Skip Navigation

[Resolved] “Manual paragraphs” setting showing empty p tags in content template

This thread is resolved. Here is a description of the problem and solution.

Problem:
"Manual paragraphs" setting showing empty

tags in the Content Template.

Solution:
1. To remove extra paragraph tags, please add the following code in your theme’s functions.php file:

remove_filter( 'the_content', 'wpautop' );
 add_filter( 'the_content', 'wpautop' , 12);
 
add_filter('the_content', 'remove_empty_p', 20, 1);
function remove_empty_p($content){
    $content = force_balance_tags($content);
    return preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content);
}

2. You can also try [wpv-noautop] shortcode and place all your content inside this:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-noautop

Relevant Documentation:
http://sww.nz/solution-to-wordpress-adding-br-and-p-tags-around-shortcodes/
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-noautop

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 6 replies, has 2 voices.

Last updated by christopherO-2 7 years, 2 months ago.

Assisted by: Noman.

Author
Posts
#521864
Screen Shot 2017-05-08 at 11.13.16 PM.png
Screen Shot 2017-05-08 at 11.13.01 PM.png

I am trying to: Render a view similar to the standard WooCommerce storefront but with a few extra custom fields

I visited this URL: hidden link

I expected to see: the Template view i created

Instead, I got: extra <p></p> tags thrown in throughout when i select " Auto-insert paragraphs". The extra <p></p> tags go away when i switch to "Manual paragraphs" but then the product description doesn't render correctly. See screenshots to see examples.

How can i render the formatted product description without the extra <p></p> tags appearing throughout the view? Honestly i'd love to be able to just get the product description without the tabs if that's possible . Thank you.

#521961

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

description.png

Hi Christopher,

Thank you for contacting Toolset support.

1. To debug this issue, I will need to take a look at your setup. So I need to request temporary access (WP-Admin and FTP Login info) to your staging site

Your next answer will be private which means only you and I have access to it.

=== Please backup your database and website ===

✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

✙ Please add the Links to the [View] Edit Screen.

2. Do you want to display the product description on the left side without tab, Like the attached screenshot?

Looking forward to help you, Thank you

#522443

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Christopher,

1. Thank you for providing login details. I am working on extra <p> tag issue and get back to you soon with an update.

2. For the 2nd problem related to “description tab” - please kindly open a new ticket and we will help you to resolve that issue as well. This will help other users with similar problems to find solutions when searching the forum, I am not allowed to handle multiple issues in the same ticket.

Thank you

#522515

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Christopher,

Please check here: hidden link

To remove extra paragraph tags, I have added the following code in your theme’s functions.php file:

remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 12);

For more info: hidden link

I have also added the following shortcode to remove <br> tags in Content Template, if you want to remove/add <br> tag then you can do it accordingly:

[wpv-noautop]

Have a great day.
Thank you

#522596
Screen Shot 2017-05-10 at 10.53.56 AM.png
Screen Shot 2017-05-10 at 10.53.51 AM.png

Although this edit is removing the unwanted <p> tags from the single product pages it is ADDING <p> tags to other pages. See the screenshots of the home page with and without the new code that was added to functions.php. How can we prevent these unwanted <p> tags from being added anywhere? Thank you

#522983

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hello Christopher,

I have updated the code, please check now all the pages.

remove_filter( 'the_content', 'wpautop' );
 add_filter( 'the_content', 'wpautop' , 12);

add_filter('the_content', 'remove_empty_p', 20, 1);
function remove_empty_p($content){
    $content = force_balance_tags($content);
    return preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content);
}

Thank you

#523263

Thank you. this is good. It is throwing extra <br> before and after images in the archive pages but i can set those display:none

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.