Archived topic
No Colour In Custom CSS - Can't switch Visual/HTML tabs
11 replies · Started by Mary Pearson on April 12, 2017
I have been having several problems with my christiangays.com website lately. The most noticeable is that I've lost the colour in my custom CSS files. I did a plugin test and no change, but when I change themes I get the colour back.
I see that I posted before about losing formatting after updating and the problem was my caching plugin so I have de-activated it, but still no colour in the custom CSS.
I also can't switch from Visual tab to HTML tab but when I change themes I can.
Would appreciate your help.
Thanks!
Hi Mary,
I'm not sure what you meant by no color in custom CSS?
GP wouldn't stop your custom CSS from being read.
I am also seeing a lot of jQuery errors on that site. Looks like a lot of it is coming from buddypress.
Can you try deactivate all non-GP plugins?
Let me know.
Hi Leo,
I did a complete plugin test before writine, deactivated ALL plugins except GP and Simple Custom CSS. There was still no colour. What I mean by that is that on the CSS page the text is normally
/* grey */
.blue {
black: 1px green solid #blue; }
but with GP theme it is all black now.
You have given me a clue though by saying that you see lots of jquery errors. I recently compressed some files. I'll bet that's the origin of the problem. I will see what I can find out. Thank you.
Any reason you are not using the Editor or GP's color add-on to change the text color?
That CSS above also doesn't really make any sense so I don't think it should work in the first place?
I was just trying to give you an example since I can't see how to send a screenshot. What I mean is that the
information between the /* */ tags is gray
the selectors are blue, example .main-title or .inside-navigation
the items like border, margin, padding, etc are black.
px is in green such as 1px
colours are in blue such as #000099
etc.
So until now I have had these items in colour but now they are black.
Like in the in the plugin itself?
Sounds like there is a syntax error somewhere.
Yes, like when I enter Custom CSS in the back end of the website, the colours are no longer there, but I think you have already given me the answer.
I think it must be from me minifying some of the javascript files. I just haven't had time to find out which ones yet, but that's what I'm going to work on now. I will leave the ticket open until I can let you know if/when I find out what the problem is.
Thank you Leo!
OK it took some looking but Leo, it was you who gave me guidance of what to look for. I had added the following to my functions.php file.
/*function to add async to all scripts*/
function js_async_attr($tag){
# Do not add async to these scripts
$scripts_to_exclude = array('https://christiangays.com/mary-content/themes/generatepress_child/js/fish.js');
foreach($scripts_to_exclude as $exclude_script){
if(true == strpos($tag, $exclude_script ) )
return $tag;
}
# Add async to all remaining scripts
return str_replace( ' src', ' async="async" src', $tag );
}
add_filter( 'script_loader_tag', 'js_async_attr', 10 );
When I removed it, voila, the website was back to normal. Can you see my coding error in it? I just copied and pasted from something I found online. I don't really know what I'm doing.
Thanks!
Mary
I don't see anything wrong really, but it doesn't look like it should be necessary either.
Thanks Tom. I was just trying to speed up my website.
Removing query strings will help your page speed rankings, but won't actually improve page speed much :)
Thank you Tom!