Skip Navigation

[Resolved] Content template css indexed by google

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

Problem

I created a Content Template and added extra CSS code.

When I inspect the elements on the Front End, I see this CSS code is added inside a style element on the head of the page.

This style element has a “style” or “type” attribute which is not needed according to the latest W3C HTML markup recommendations.

How do we fix this?

This support ticket is created 6 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
- - 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)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Beda 6 years ago.

Assisted by: Beda.

Author
Posts
#611683

The css of content templates are loaded in the header like this:
<style style="text/css" media="screen">
I think it has to be like:
<style type="text/css" media="screen">
Now the custom css of content templates is indexed by google.

#611795

True, it's strange, and I agree, it should be the attribute "type", not "style".

Let me report this to the developers as a bug.

#611807

Thanks!

Fixed the issue temporarily by changing the following line:
/wp-content/plugins/wp-views/embedded/inc/views-templates/wpv-template.class.php:1070
Changed the style attribute into type attribute.

#611872

I reopen this here so I can notify you when it's solved

#615349

We have an erratum for this now:
https://toolset.com/errata/remove-unused-style-and-type-attribute-from-the-style-element/

Please let me know if you encounter any other issue I may help with.

#624604

Please, can you confirm that the erratum works for you as well?

#624622

Just updated to the latest version 2.2.22 (cleaned cache also).
When i inspect the page with chrome developer tools i still find 'style="text/css"' inside jquery scripts:

jQuery( document ).ready( function( $ ) {
	var extra_css = $( "#views-extra-css" ) ? $( "#views-extra-css" ).text() : null;	if( extra_css ) {		$( 'head' ).append( '<style style="text/css" media="screen">' + extra_css + '</style>' );
		$( "#views-extra-css" ).remove();	}
	$( 'head' ).append( $( "#views-extra-css-ie7" ).html() );
	$( "#views-extra-css-ie7" ).remove();});
jQuery( document ).ready( function( $ ) {
		$( 'head' ).append( '<style style="text/css" media="screen">' + $( "#ct-extra-css" ).text() + '</style>' );
		$( "#ct-extra-css" ).remove();});
#679950
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.