Wordpress: Not able to retrieve css for new plugin in admin mode
- by Steven
I'm creating a new plugin which will have it's own css file. The css file resides in the root folder of the plugin.
In the plugin section of the admin interface, I have added a few text fields fields. But the CSS is not applied.
I'm adding the CSS file using this code:
// Register styling
add_action('admin_init', 'event_styles');
function event_styles() {
wp_register_style('event_cal', plugins_url('eventcall.css',__FILE__));
wp_enqueue_style('event_cal');
}
The following code gives me the CSS path:
echo plugins_url('eventcall.css',__FILE__);
and outputs
http://mysite.com/wp-content/plugins/wp-eventcal/eventcall.css
If I try to enter this URL directly in the browser, it only shows me the front page.
And if I look in the source code using Firebug, where the link to the CSS should be, I only find the entire HTML code for the front page.
Am I using wrong code to use backend in admin interface?
In my HOST file, I have added ``