Why Wordpress displays a preview of the published post without the styles?

When you save the post and press view (appears after saving) open the address
http://localhost:8888/test/2020/01/01/16/

Although the correct address of the post must look like this:
http://localhost:8888/test/2020/01/01/

At the end somehow appears figure 16 and fly all css styles of the theme. In the file functions.php Nou criminality:
<?php 
script_and_styles function() {
 wp_enqueue_style( 'style', get_template_directory_uri() . '/css/style.css' );
} 
 add_action( 'wp_enqueue_scripts', 'script_and_styles' );


On a similar website on the web with the same file functions.php styles are not switched off and left address not added \_(ツ)_/
April 4th 20 at 00:29
2 answers
April 4th 20 at 00:31
Please contact your TP localhost.
April 4th 20 at 00:33
Replace in quotes for style my-style
The same. And how could it help? - alessia.Breitenberg commented on April 4th 20 at 00:36
@alessia.Breitenberg, try to use get_stylesheet_directory_uri - Lola.Rohan78 commented on April 4th 20 at 00:39
So?
wp_enqueue_style( 'style', get_stylesheet_directory_uri() . '/css/style.css' );


Instead
wp_enqueue_style( 'style', get_template_directory_uri() . '/css/style.css' );


Not working. - alessia.Breitenberg commented on April 4th 20 at 00:42
@alessia.Breitenberg, you need to be at least the address of the file showed the inspector that we did not expect. - Lola.Rohan78 commented on April 4th 20 at 00:45
@Lola.Rohan78, sorry, the link with css absent, inside the head tag is empty - alessia.Breitenberg commented on April 4th 20 at 00:48
@alessia.Breitenberg, then jamb the template - Lola.Rohan78 commented on April 4th 20 at 00:51

Find more questions by tags WordPress