Add Css With wp_enqueue Functions.php

header.php calls this function.php thru <?php wp_head(); ?>

On functions.php file, add this to get css files to header.php

<?php 
function load_custom_css_and_js_files(){
    wp_enqueue_style('custom_main_styles', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'load_custom_css_and_js_files');

This will add the style.css file under themes/style.css

notice how add_action(‘wp_enqueue_scripts’, ‘load_custom_css_and_js_files)

calls on the second parameter the function load_custom_css_and_js_files()


//These Are The WordPress Functions Used Here

add_action('wp_enqueue_scripts','any_name_here');

with it's second parameter calls a function that has this command

wp_enqueue_style('another_name','get_stylesheet_uri()'); --> loads in this case css
Scroll to Top