How to define and link full path to css located at a random folder on header.php

You should look into wp_enqueue_script() and wp_enque_style(), they’ll handle the assembly and placement of the script/style tag, and the dependancy order – inside of your header (via wp_head()) or footer if you like to load your assets at the bottom of your page.

So, for your example, something like

add_action( "wp_enqueue_scripts", function(){
    wp_enqueue_style( 
        'mythemelightbox', 
        get_template_directory_uri().'/lightbox2-master/lightbox2-master/src/css/lightbox.css', 
        [], 
        false
    );
});

note that get_template_directory_uri() is what builds your current domain with the path to the current theme.

Leave a Comment