Problem in enqueuing wordpress styles

hi everybody. i’m trying to make a new wordpress template. to enqueue the styles, i’ve put the

<?php wp_head(); ?> 

before the closing tag in the index.php file. (i dont have a header.php file.);
in my functions files i wrote this code:

// Includes
include( get_template_directory() . '/includes/front/enqueue.php' );
// Action Hooks
add_action( 'wp_enqueue_scripts', 'dr_enqueue' ); 

in the ‘includes/front/enqueue.php’ i have this code:

<?php 

function dr_enqueue() {
    wp_register_style( 'dr_bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css' ); 
    wp_enqueue_style( 'dr_bootstrap' );
}

and the bootstrap file is in the correct address of my template.
the problem is i dont get the style and its not working …
where am i wrong in this bit of code ?

Hi, Are you sure you have the get directory right?

(Sounds like this could be more of a PHP topic, could it not? I’m no longer a WP user since a long time. )

my bootstrap file is in the : themnamefolder/assets/css/bootstrap.css

and the enqueue file is in the themenamefolder/includes/front/enqueue.php

i think it’s right …

Have you considered the https://codex.wordpress.org/Function_Reference/get_stylesheet_directory for the register function?

Please mind I’ve no means to check if my ideas are useful.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.