wp_head in add_action doesn't work
-
Hello,
I’m developing my first plugin and I’d like to add a link tag inside head to call a CSS file to style my options page.
My plugin has the follow code (all my code, except the license coments)
if( !defined( ‘ABSPATH’ ) ) exit;
define( ‘EASYDM_VERSION’, ‘1.0’ );
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_IMAGES_URL’, plugin_dir_url( __FILE__ ).’images/’ );
define( ‘EASYDM_IMAGES_DIR’, plugin_dir_path( __FILE__ ).’images/’ );
define( ‘EASYDM_IMAGES_PATH’, ‘images/’ );define( ‘EASYDM_CSS_URL’, plugin_dir_url( __FILE__ ).’css/’ );
define( ‘EASYDM_CSS_DIR’, plugin_dir_path( __FILE__ ).’css/’ );
define( ‘EASYDM_CSS_PATH’, ‘css/’ );define( ‘EASYDM_INCLUDES_URL’, plugin_dir_url( __FILE__ ).’includes/’ );
define( ‘EASYDM_INCLUDES_DIR’, plugin_dir_path( __FILE__ ).’includes/’ );
define( ‘EASYDM_INCLUDES_PATH’, ‘includes/’ );require_once EASYDM_SETTINGS_PATH.’easydm-functions.php’;
//add_filter( ‘wp_head’,’easydm_add_link_tag_to_head’ );
add_action( ‘wp_head’, ‘easydm_add_link_tag_to_head’ );
//do_action( ‘wp_head’ );add_action( ‘admin_menu’, ‘easydm_top_level_menu’ );
From the constants is possible to conclude the directories structure of the plugin. Another directories are actually empty.
The ‘easydm-functions.php’ has the follow function:function easydm_add_link_tag_to_head() {
$path = __DIR__.’/../css/’;
echo ‘<link rel=”stylesheet” type=”text/css” href=”‘.$path.’style.css” />’;
}I expected to find this link tag in the source code but I can’t. The tag doesn’t appear there.
Reading many tutorials and forums questions about this, no much is different from this.
I’m developing in localhost, apache2, Ubuntu 14.04 LTS.
Some help?
Thanks
- The topic ‘wp_head in add_action doesn't work’ is closed to new replies.