mardi 1 mars 2016

wp_enqueue_style doesn't work

First of all, I tried this and didn't work: "http://ift.tt/1Qldf8h".

What I want to do is a plugin with a unique page (options page) and I'm trying to insert in head tag a <link href="my_dir/css/style.css"/>. The prefix of my plugin is easydm and has in the main file the followingo code:

define( 'EASYDM_VERSION', '1.0' );
define( 'EASYDM__MINIMUM_WP_VERSION', '2.1' );
define( 'EASYDM_DIRECTORY_NAME', 'easy-downloader-manager/' );

define( 'EASYDM_ROOT_DIRECTORY', substr( plugin_dir_path( __FILE__ ), 0, strpos( plugin_dir_path( __FILE__ ), EASYDM_DIRECTORY_NAME ) ) );

define( 'EASYDM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'EASYDM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );

define( 'EASYDM_SETTINGS_URL', plugin_dir_url( __FILE__ ).'settings/' );
define( 'EASYDM_SETTINGS_DIR', plugin_dir_path( __FILE__ ).'settings/' );
define( 'EASYDM_SETTINGS_PATH', 'settings/' );

define( 'EASYDM_CSS_URL', plugin_dir_url( __FILE__ ).'css/' );
define( 'EASYDM_CSS_DIR', plugin_dir_path( __FILE__ ).'css/' );
define( 'EASYDM_CSS_PATH', 'css/' );    

require_once EASYDM_SETTINGS_DIR.'easydm-functions.php';

register_activation_hook( __FILE__, 'easydm_activation');

add_action( 'wp_enqueue_scripts', 'easydm_add_link_tag_to_head' );

My easydm-functions.php has:

function easydm_add_link_tag_to_head() {
    wp_enqueue_style( 'style', get_plugin_directory_uri().'/'.EASYDM_DIRECTORY_NAME.EASYDM_CSS_PATH.'style.css' );
}

This is my last try, but I tried some other arguments on wp_enqueue_style() function.

Some help?

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire