开发者

Wordpress: Not able to retrieve css for new plugin in admin mode [closed]

开发者 https://www.devze.com 2023-01-03 06:08 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

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 added 127.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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号