Skip Navigation

[Resolved] unnecessary code in source

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

Problem:

The user was complaining about an unnecessary line of code on their page.

Solution:

Unfortunately upon checking the user's page I was not able to see such a line of code anywhere on the page.

This support ticket is created 6 years, 6 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 13 replies, has 3 voices.

Last updated by Shane 6 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#954442

Hey there,

When I look to the source code of my pages I see a generated div: <div id="ct-extra-css" style="display:none;" aria-hidden="true"> /* ----------------------------------------- loads of comments ----------------------------------------- */</div> .

This code seems very unnecessary. I do wonder however why this code is added, and is it possible to remove from the page source? Since it uses bandwidth of the users I prefer no loading it if it's not necessary.

Looking forwad to your reply.

Cheers,
Jaco

#954547

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jaco,

Thank you for contacting our support forum.

This seems to be related to our custom css for content template. I believe this is loaded because you may have some custom css using our content template.

However it should just load a script tag.

Could you let me know what version of our views plugin you are using ?

Thanks,
Shane

#954584

Hey Shane,

Thanks for the reply. We are using the views plugin 2.6.3.

As for the custom css: I have not added any in the content template css editor field.

#954656

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jaco,

The best way I can decide to remove this or hide it by using CSS.

But seeing this it's already hidden so its not something we can do anything about since once of our plugins might be using it.

If not views then Layouts which can also be used to add custom css.

Thanks,
Shane

#955412

It's not vissible on the front-end indeed. But it still is in the source code and I'd prefer to get rid off it. I can't find any custom css in the content templates nor in the layouts/view section.

But do I understand you correct that it is impossible to get rid of this line code in the page source?

#955595

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jaco,

Thats correct, however i need to look at this further as for me only a script tag appears with the same class name on my pages.

If you were to disable the non-toolset plugins does this issue still occur?

Also Could you send me a link to the page where this happens ? I really don't think that 1 line of HTML code will have any impact on bandwidth.

Looking forward to hearing from you soon.

Thanks,
Shane

#956439

Hey Shane,

When I disable non-toolset plugins the code still seems to be loaded in the page source code.

You are right about it doesn't take a lot of bandwidth, but if we think about that often enough it will eventually get cluttered. I prefer not to load code when it's not necessary.

I can send you over the url, is it possible to do that somewhere private?

Cheers,
Jaco

#956567

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jaco,

I've enabled the private fields for you.

Thanks,
Shane

#990357

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screen Shot 2018-07-30 at 10.11.07 AM.png

Hi Jaco,

I'm not able to find that line of code on the page.

The code that i see is a script tag. See Screenshot

Thanks,
Shane

#1070084

Also you will find the line: <div id="ct-extra-css" style="display:none;" aria-hidden="true">commented content</div> on line 17 of the source code. That was the line I meant. It looks like it is added by the toolset plugins.

#1070345

Hi, Shane is on public holiday today and will return tomorrow to assist you.

#1071412

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jaco,

As mention previously i'm not able to find this line

<div id="ct-extra-css" style="display:none;" aria-hidden="true">commented content</div>

At least not on the homepage. The only thing that was found was a script tag using the same ID.

Thanks,
Shane

#1074913

I believe we mean the same tag, It is on line 17 of the source code; it's not a script as far as i can see. It ís after a </script> tag which means the script part is closed.

I used the term "commented content" because the content in that div is commented out.

#1076319

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jaco,

The best thing for you to do is to provide a screenshot of the code because this is what I see on my end
https://toolset.com/forums/topic/unnecessary-code-in-source/#post-990357

Which is normal.

Thanks,
Shane