enqueue script/style plungin development

You’ve given wp_enqueue_style a directory, but no file name. Have a look at https://developer.wordpress.org/reference/functions/wp_enqueue_style/:

  • The first parameter of wp_enqueue_style is the name, or handle, of the stylesheet as referred to internally by WordPress (this should be a unique name for each stylesheet you enqueue)
  • The second parameter is the src to the stylesheet – so this is where you need to add both your directory and your stylesheet name

So, if you change your second parameter to EASYDM_CSS_DIR . "style.css" – and just use something like 'my-stylesheet' as the first parameter, providing everything is in the right place you should find it works. 🙂

EDIT

Just noticed something I didn’t pick up earlier in your code: there’s actually no wp_enqueue_style action. You need to use the wp_enqueue_scripts action to add both styles and scripts. This is a bit confusing, because the function wp_enqueue_style you’ve used is correct, but it’s never being called because of the incorrect action.

Change this:

add_action( 'wp_enqueue_style', 'easydm_add_link_tag_to_head' );

to this:

add_action( 'wp_enqueue_scripts', 'easydm_add_link_tag_to_head' );

and then your function easydm_add_link_tag_to_head should be called correctly.

If it’s still not working, it’s probably down to either the path not being correct, or something else I didn’t notice in the code! This is where we need to start debugging to find the issue. The simplest, crudest, easiest way to do this is just to put echo 1;, echo 2;, echo 3; etc. in different parts of your code – and then viewing the source of your page – to determine what is working and what isn’t. Of course, it’s also worth checking if the <link> tag is making it through to the source of your page, because if it is, the clue might be in the path not being correct!