L
L
lex2k2018-02-19 02:05:53
css
lex2k, 2018-02-19 02:05:53

How to solve the problem with including style.css in Wordpress?

The situation is as follows, I am transferring a simple layout to Wordpress.
In the theme folder, I created all the necessary files, including style.css and functions.php.
I wrote the following in functions.php.

<?php

  add_action('wp_enqueue_scripts', 'test_media');
  
  function test_media(){
    
    wp_enqueue_style('test-main', get_template_directory_uri() . '/style.css');

    wp_enqueue_script('test-script-main', get_template_directory_uri() . '/assets/js/script.js');
  }

He also wrote like this
function test_media(){
    wp_enqueue_style('test-main', get_stylesheet_uri());

    wp_enqueue_script('test-script-main', get_template_directory_uri() . '/assets/js/script.js');
  }

Style.css is in the same folder as functions.php
Admin sees these files in the editor, but for some reason does not apply.
The cache was deleted, it's definitely not in it. through F12 you can see that the default css style is applied, not mine.
Help solve this problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lex2k, 2018-02-19
@lex2k

Thanks everyone for helping.

<?php wp_head(); ?>
<?php wp_footer(); ?>

D
Dima, 2018-02-19
Dolgoter @DDolgy

Sorry for the stupidity. Connect immediately in the header as per the standard

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question