A
A
Alex_872021-12-30 10:54:11
WordPress
Alex_87, 2021-12-30 10:54:11

How to disable styles NOT registered in functions.php?

Good afternoon! Please help!
Please help!

The article on the topic of increasing site speed: https://habr.com/ru/post/264033/ says that after unregistering styles, the rest of the styles remain in style.css and are loaded by the script. For example, with this line in the footer:

<script> jQuery("head").append("<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?> " type="text/css" media="screen">"); </script>

How are they written in style css? I additionally need to prescribe something, they will not be automatically added somehow?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2021-12-30
@Alex_87

In the article we are talking about the fact that YOU should give the user styles such a bone.

Further, it is important to give the user the first screen as quickly as possible. All styles responsible for rendering the first screen are minimized and placed directly on the page, in the head.
The remaining styles remain in style.css and are loaded by the script. For example, with this line in the footer:
<script> jQuery("head").append("<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?> " type="text/css" media="screen">"); </script>

In order for users with disabled JS to see the correct page, we frame the standard output of styles in noscript, PageSpeed ​​does not take this line into account:
<noscript><link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_uri(); ?>" /></noscript>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question