So, I've not used Wordpress in a long time, and I'm trying to get back into the swing of things. Apparently the correct way to deal with external CSS/JS is to enqueue them using wp_register_style
, wp_enqueue_style
, wp_register_script
, and wp_enqueue_script
... but they're not working for me at all.
The following is my current functions.php
:
<?php
// Enqueue necessary scripts/etc.
function wasd_styles() {
wp_register_style('semantic-css', get_stylesheet_directory_uri() . '/lib/semantic.min.css');
wp_enqueue_style('semantic-css');
}
function wasd_scripts() {
wp_register_script('semantic-js', get_template_directory_uri() . '/lib/semantic.min.js');
wp_enqueue_script('semantic-js');
}
add_action('wp_enqueue_scripts', 'wasd_styles');
add_action('wp_enqueue_scripts', 'wasd_scripts');
?>
Is there something I'm doing wrong? As far as I can tell, it should be injecting the proper calls to grab CSS/JS into the tag of my page, but..it's not.
The following are the two files I'm attempting to render, I threw this together in like 5 minutes to attempt to test Semantic UI, but it's just not working at all, no style is being rendered, and is empty upon source inspection.
index.php
<?php get_header(); ?>
<div class="ui main container">
<h2 class="ui dividing header">This is a test</h2>
</div>
header.php
<div class="ui top fixed inverted menu">
<div class="item">Test</div>
</div>