Skip Navigation

[Resolved] Toolset inserting P elements above and below shortcode blocks

This support ticket is created 3 years, 8 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.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 7 replies, has 2 voices.

Last updated by kostaB 3 years, 8 months ago.

Assisted by: Jamal.

Author
Posts
#2023219

I am trying to: Insert a shortcode using the WP shortcode block, in the Toolset products archive loop and a Toolset content template

Link to a page where the issue can be seen: The heart-shaped add-to-wishlist icon:

hidden link

hidden link

I expected to see: The content of the shortcode

Instead, I got: The content of the shortcode, with a P element being added above and below the. Styled by my browser's user agent stylesheet.

I know the user agent stylesheet is a browser thing, but the P element isn't. And when I insert it just using a hooked element of my theme, the P elements aren't there. This is only something that happens when I use the native shortcode block in a Toolset template.

#2023539

Hello and thank you for contacting the Toolset support.

To better assist you with this issue, I'll need more details on how do you use the shortcode and what shortcode?

From what I gathered so far, it seems that you are building the products archive using the blocks editor, right? How are you adding this shortcode? Using the shortcode block, the classic block or the Fields&Text block?

Can you try inside a "Fields&Text block"? If the issue persists can you wrap the shortcode inside the wpv-noautop shortcode?
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-310704

In the meantime, as a workaround, you can add the following Javascript code to the content template and the archive template:

jQuery(function($){
  $('p:empty').remove()
})
#2023567

Hi, thank you for your quick response! If all else fails, I will use the js. It worked on one of the icons, but I will see how the problem will be solved before I apply that to the rest.

I'm using the shortcode of TI Wishlist.

I'm using this one in the archive loop:
[ti_wishlists_addtowishlist loop=yes]

And this one to the product page:
[ti_wishlists_addtowishlist]

It allows customers to, in one click, add and remove products to and from their wishlist.

For this I was using the WP's native shortcode block. In the block editor.

I just did it in the fields&text block in the content template on the product page. It's in the content template for related products.

I inserted it like this:

[wpv-noautop]
[ti_wishlists_addtowishlist loop=yes]
[/wpv-noautop]

It's still showing the problem marking up with 'p' regardless.

You can see it for yourself here:

hidden link

Above and below the heart icon under "you might also like", in the products loop.

#2023607

Maybe that's also caused by a compatibility conflict with another component of the website. Please check if this issue appears when:
- Only Toolset plugins are activated. It will tell us if there is an interaction issue with another plugin.
- The theme is set to a WordPress default like Twenty-Twenty. It will tell us if there is an interaction issue with your theme.
If the problem disappears, start activating one at a time to track where the incompatibility is produced.

If this does not help, please allow me temporary access to your website and let me check it closely. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

If I can't fix it, I'll need to take a copy of your website and debug it locally, let me know if you allow me that.

#2023615

Hi, clicking on 'show private message' in my original post ought alrady contain all the information you need to have a look?

I will do the process of elimination now. I will keep you posted on the progress.

#2023637

So I followed all your steps: Changed themes and deactivated plugins. Having said all that, the problem was already present when the only plugins that were active were:

Toolset (Blocks/Types/WooCommerce Blocks)
WooCommerce
TI Wishlist

When I deactivate TI Wishlist, logically, the add to wishlist button isn't visible anymore, but neither are the empty P elements. So the p elements are only added when the shortcode is actually displaying content.

This might hint at a lack of compatibility between these two plugins. However, my previous wishlist plugin showed the exact same issue (Iconic's wishlist plugin). Same issue. So I think it would be highly coincidental if it was just that.

Having said that, I just tried inserting a different plugin's shortcode, a donation form. Same thing: inserted empty P elements.

So yes, I doubt it's merely down to incompatibility.

#2023645

My apologies, I missed the credentials on the first message of this thread.

I used the plugin's shortcode inside a Fields&Text block and it did not generate empty tags before and after it as you can see now on the product archive page. Check this screenshot hidden link
Let me know if this is a viable solution for you.

Please note that you will need to clear WP Rocket cache after updating the content template to reflect the new changes.

#2023681

That's what I did! I also always clear the cache. The last time I used the fields&text plugin, it added P elements, but within them, added <br> elements. So, it's funky that you're doing it now without issue. But I'm not complaining. Thank you for your help, it worked!