skip to Main Content

Hopefully some of you can assist me a bit. I don’t have clue why the wordpress theme output is not including style.css. There is only correct path to theme directory but style.css is missing "…themes/wp-test-theme?ver=6.7.1"

functions.php
function my_theme_scripts() {

wp_enqueue_style( 'style-own', get_stylesheet_directory_uri(  ) );

}

add_action( ‘wp_enqueue_scripts’, ‘my_theme_scripts’ );

OUTPUT

link rel="stylesheet" id="style-own-css" href="http://localhost/wp-test/wp-content/themes/wp-test-theme?ver=6.7.1" type="text/css" media="all">

2

Answers


  1. try this.

    To include style.css, you need to specify its full path.
    functions.php

    function my_theme_scripts() {
       
        wp_enqueue_style( 'style-own', get_stylesheet_directory_uri() . '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_scripts' );
    
    Login or Signup to reply.
  2. try this code.

    You Enqueue Parent and Child Theme Styles Below Code Use ‘functions.php’ file:

    function my_child_theme_enqueue_styles() {
        // Enqueue Parent Theme Style
        wp_enqueue_style('parent-theme-style', get_template_directory_uri() . '/style.css');
        
        // Enqueue Child Theme Style (after Parent Style)
        wp_enqueue_style('child-theme-style', get_stylesheet_directory_uri() . '/style.css', array('parent-theme-style'), wp_get_theme()->get('Version'));
    }
    add_action('wp_enqueue_scripts', 'my_child_theme_enqueue_styles');
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search