Skip Navigation

[Résolu] Divi Builder adding classes around Content Templates

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
When I render content in a View's loop with a Content Template and the content rendered is designed with the Divi Builder, but the Content Template with which I design the Loop output is not, then it seems Divi Builder adds the following HTML around the output of the Content Template:

<div id="et-boc" class="et-boc"
<div class="et_builder_inner_content et_pb_gutters3">

Solution:
This is Divi Builder injecting it's HTML at the_content() filter no matter when or where it's rendered.

The issue can be solved by using Toolset's inbuilt feature to unallow 3rd parties filtering the content when using Content Templates.
This can be done by passing suppress_filters="true" to the template:

[wpv-post-body view_template="loop-item-in-your_view" suppress_filters="true"]
This support ticket is created Il y a 5 années et 3 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Ce sujet contient 20 réponses, a 4 voix.

Dernière mise à jour par Beda Il y a 5 années et 3 mois.

Assisté par: Beda.

Auteur
Publications
#1301433

These are my findings:

1. According to the user of https://toolset.com/forums/topic/question-about-very-strange-wrapping-of-of-views-template-in-divi-3-10-1/, Divi seems to have planned to retire that code because it did not only happen on Toolset, but always when Divi or the Builder was active.
You can see that in the user's last reply of the ticket
This problem is hence not on Toolset and should have been fixed by Divi / Elegant Themes

2. You say, "Using toolset views generated shortcode in a page template designed with divi builder layout.", but later I was informed this happens on Content Templates in the View loop NOT designed with the Builder.
This is not replicable locally or fresh installs

3. In any case, if those div's are still outout like you mention here https://toolset.com/forums/topic/question-about-very-strange-wrapping-of-of-views-template-in-divi/#post-1295427, this should be reported to Divi/Elegant Themes (in case they did not yet fix that)

4. You later confirm that it only happens if such View is inserted in a post designed with the Builder (https://toolset.com/forums/topic/question-about-very-strange-wrapping-of-of-views-template-in-divi/#post-1297783)
I also tried that (even with a - wrong but possible - code widget of the builder)

5. I see you already provided a Duplicate a while ago and I am now deploying that to find the issue and it's cause.
I'm back as soon I have completed that task.

#1301463

Deploying this site I find something strange when listing Pages Post Type in the Admin list.
There is at the bottom an unexpected output:

This is the generated shortcode, based on the settings that you have selected:
You can now copy and paste this shortcode anywhere you want.

What's that? It is not an expected output, I'd suggest investigating what this is by disabling plugins and theme to see where it comes from.

In any case, on the Home Page, I see also PHP errors:

Warning: explode(): Empty delimiter in /duplicator/dp-stgz/plugins/wp-views/vendor/toolset/toolset-common/inc/autoloaded/utils/Attachments.php on line 45

I notice, the wp-content folder is renamed, and there is an error related to Toolset here, it's related to code that gets Images in the database by ID.
On that home page, the builder results NOT ACTIVE.

There is another error on the backend:

Failed to load plugin url: <em><u>lien caché</u></em>

Notice the URL is all messed up?
First we see that the wp-content is renamed to dp-stgz, but then in this last URL, there is a totally missing / slash and instead - is used!
This is not something Toolset can do unless edited manually or the renaming of WP Content Folder was done wrong.
It seems literally to cal twice another URL

Of course, if debug mode is turned off you will never see those issues - but that doesn't mean it will still work as supposed.
When I try to edit a page with the builder on this duplicate, the builder never loads.

So, in this duplicate, I cannot see the issue, as it's somehow broken (that maybe only on the Duplicate or on the live site as well, I am not sure)

I've checked the other testing URl you provided, lien caché, there is however no Divi Edited Homepage there.
Also, the View mentioned is not existing (wp-admin/admin.php?page=views-editor&view_id=17)

I found finally this lien caché, where the issue seems visible.
I see there you insert (with the builder) [wpv-view name="view-allo"], and that View, in turn, has a Content Template for the Loop.

The best solution to not allow Divi or the Builder to add it's classed in the Views loop, in this case, is passing the Content Template like this:
[wpv-post-body view_template="loop-item-in-view-allo" suppress_filters="true"]
See, we add a suppress_filters="true", this means, other software will not be allowed to hook into the content rendered by Toolset, and hence, even if Divi or the builder add DIV's where not required, those won't appear on Toolset Content Templates - since you suppress their filters.

Or, as Minesh elaborated you might not use a Content in the View - which has a similar effect.

The root cause to this however seems not on our end, it's Divi/The builder that adds those DIV's to stuff shown thru the_content filter.
We probably cannot solve this in any other manner than suppressing their filter which is done as above shown.
See also https://toolset.com/forums/topic/whats-up-with-et-boc-and-et_builder_inner_content/, https://toolset.com/forums/topic/question-about-very-strange-wrapping-of-of-views-template-in-divi-3-10-1/#post-952322

I think I am now also able to replicate this locally and can confirm as well the solution for this exceptional case:

1. You need to actually design the SINGLE posts of a type (displayed later in Views) with the Builder
2. Then you need a Content Template rendering the View's loop
3. This then should be inserted in a page using the builder

In this case, the builder applies it's styles to the single posts.
That, even if their post data is called in a View loop, and hence, they add the Div
This is clearly to avoid by suppressing filters as there is nothing in Toolset that could stop that (and you would theoretically be supposed to design the CT's with the builder hence never stumble on this issue)

We added that suppress_fiters exactly for this reason.
Note in the DOC:
If suppress_filters=’true’, all third party (non WordPress) filters hooked into the_content filter will be removed, when retrieving the post body. In certain circumstances, plugins using this filter can add duplicated content to the post body – removing the filters can resolve this problem.

That is exactly the cause here, Divi and the Builder hook in the content, add their default DIV, and this simply whenever Divi or the Builder are used to design those single posts.

Is the issue as well resolved for you if you pass suppress_filters?

#1301597

Thanks Minesha and Bedo,

The suppress filter removed the extra div injection.

1) "Of course, if debug mode is turned off you will never see those issues - but that doesn't mean it will still work as supposed"
yes we chnged the wp-content - debug is always on during production - we found no such error in our log as stated but thanks for the insights.

2) "You need to actually design the SINGLE posts of a type (displayed later in Views) with the Builder"
Aware of that but maybe is only on our side, divi builder doesnt work on the content template.

3) "The root cause to this however seems not on our end, it's Divi/The builder that adds those DIV's to stuff shown thru the_content filter."
Totally agree. Contacted divi support, there were little they can do but they cfm the injections. We contacted fb page, got slammed that's 3rd dev problem, not divi. Fair.. we gave up on both end, doing own custom query instead tho' it seems to defeat toolset awesome view's purpose.. that's until you guys came in and gave the solution content template suppress filter

#1301599

Wish to thank both Minesh and esp Beda for his extensive insights in this matter.

#1301603

i'll be removing my domain url and pls do the same. Thanks again Beda

#1301867

URL's are not publicly visible (they are hidden) when someone visits this thread who are not involved (me, you, and other Toolset Supporters).
You would not need to clean up the threads hence 🙂

Great also the solution works on your end too, and I'd suggest opening a new ticket for this issue:
"Aware of that but maybe is only on our side, divi builder doesnt work on the content template."
The Divi page builder works fine with Toolset (unless there are some conflicts which we can help to solve in a new ticket), see https://toolset.com/2017/12/how-to-use-toolset-with-different-page-builders/

Thanks!