So I’ve been messing with this for a while now and I don’t understand how I’m unable to pull in my style file properly by registering and calling it at all.
Here is my method:
public static function register_styles()
{
add_action('wp_enqueue_scripts', function() {
global $post;
if (is_page('foodies')) {
var_dump('Hello!');
//Adding stylesheets
wp_register_style('profile-style', '/Users/smajlovs/Sites/newsacfoodies/htdocs/wp-content/mu-plugins/sacfoodies/styles/style.css');
//Enqueue the style
wp_enqueue_style('profile-style', '/Users/smajlovs/Sites/newsacfoodies/htdocs/wp-content/mu-plugins/sacfoodies/styles/style.css');
}
if ($post->post_type == 'profile') {
echo 'Hello! I am the register_styles method on the profile custom post type page';
}
return;
});
}
Within my main sacfoodies.php file, I’m calling Profile::register_styles()
.
The confusing part is, the var_dump
that I have inside that function actually dumps out the hello on that page as shown here:
var_dump(wp_enqueue_style('profile-style'));
returns null
So does anyone know why my enqueue register and call won’t render my style.css file? I have the absolute path in there for testing purposes and nothing.