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 sourc开发者_高级运维e 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?
FYI: In my HOST file, I have added127.0.0.1 mysite.com
Ok, I found the problem. A bit embarrassing.
It was a typo - one 'l' to many. Correct name of CSS was eventcal.css
.
I had no idea that the result would be for the link to load the entire front page. But now I know.
精彩评论