Skip Navigation

[Gelöst] remove html comments

This support ticket is created vor 5 Jahre, 4 Monate. 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
- 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: Asia/Karachi (GMT+05:00)

This topic contains 10 Antworten, has 2 Stimmen.

Last updated by Akhil vor 5 Jahre, 3 Monate.

Assisted by: Waqar.

Author
Artikel
#1171695

Hi. there is few lines of html comments created by the layout plugin i guess. is there any way to remove those ? i like my source code to be clean, third party remove html comment unable to remove this strangely.

Thanks.

#1172188

Waqar
Supporter

Languages: Englisch (English )

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

Hi Dee,

Thanks for asking! I'd be happy to help.

Can you please share a link to the page or a screenshot, to see the comment lines you're referring to?

I'll be in a better position to guide you accordingly.

regards,
Waqar

#1172542

hi. you need to view the source .
sample here: hidden link

i am guessing its created by toolset plugin when the css/js tab is used.

is there any way to remove them ? any existing hooks ? or regex fn ?

thanks

#1172589

Waqar
Supporter

Languages: Englisch (English )

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

Hi Dee,

Thank you for sharing the screenshot.

Those HTML comments are added wrapped around the custom CSS and JS code, which is added through view's "CSS editor" and "JS editor" tabs, respectively.

Unfortunately, there is no filter or hook available to suppress or remove them, but if you'd prefer not to have them on your pages, you can remove any custom CSS and JS code that exists in your views and load them through third-party plugins like:

https://wordpress.org/plugins/wp-add-custom-css/
https://wordpress.org/plugins/custom-css-js/

regards,
Waqar

#1172717

Hi ,
thanks for sharing the other approach. make sense as i already have those plugins.

is there anyway to disable toolset css, jss tabs when editing ? [so wont cause confusion]

how about if we can comment out some line in the code that generating this comments manually ,
i'm sure that i need to make this changes every time i update toolset.

thanks

#1172994

Waqar
Supporter

Languages: Englisch (English )

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

Hi Dee,

You can add the following code in the active theme's "functions.php" file to hide the "CSS editor" and "JS editor" tabs, from the view's edit screen:


add_action('admin_head', 'my_custom_admin_styles');

function my_custom_admin_styles() {
echo '<style>
.toolset_page_views-editor .wpv-editor-metadata-toggle[data-instance="filter-css-editor"],
.toolset_page_views-editor .wpv-editor-metadata-toggle[data-instance="filter-js-editor"] {
	display: none;
}
</style>';
}

If you're fine with the unrecommended approach of editing the core plugin files to remove those HTML comments, you'll find the multiple instances in the file:
wp-views/embedded/inc/wpv.class.php
(just search for the string "views-extra-css")

regards,
Waqar

#1172995

wow, youre still here !

Ill check the approach and update you soon.
Have a good rest Waqar .

#1173274

Waqar
Supporter

Languages: Englisch (English )

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

Thank you so much, Dee and I'll wait for an update.

You're welcome to open a new ticket for a different question/concern.

regards,
Waqar

#1173292

hi Waqar, i manage to remove most of them, except from content template

/* ----------------------------------------- */
/* Content Template: GALLERY start */
/* ----------------------------------------- */

thanks.

#1173351

Waqar
Supporter

Languages: Englisch (English )

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

Hi Dee,

You'll find the code for that comment in the file:
wp-views/embedded/inc/views-templates/wpv-template.class.php
(just search for the string "Content Template:")

Note: to find specific strings or block of code, I use "NetBeans IDE" ( hidden link ) since it allows text search across the entire project. You can add specific plugin's folder as a project and then perform a search, as needed.

regards,
Waqar

#1174924

My issue is resolved now. Thank you!

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