I am trying to load my style sheets in my plugin but they are not being called, the javascript files however, are being loaded.
<?php
/**
Plugin Name:
Plugin URI:
Description:
Version:
Author:
Author URI:
**/
define("MPF_PATH", ABSPATH . 'wp-content/plugins/' . basename(dirname(__FILE__)).'/' );
define("MPF_URL", trailingslashit(get_option('siteurl')) . 'wp-content/plugins/' . basename(dirname(__FILE__)) . '/' );
class mpf_plugin{
function crf_user_registration(){
add_action('plugins_loaded', array(&$this, "load_my_scripts"));
add_action('admin_menu', array(&$this,'add_crf_menu_items'));
if(!is_admin()){
add_shortcode('crf_registration', array(&$this, "do_shortcode"));
} else {
//do something else here
}
}
function load_my_scripts(){
if(is_admin()){
wp_register_script('crf_script', MPF_URL . 'includes/js/crf_script.js');
wp_register_style('crf_style', MPF_URL . 'includes/css/crf_style.css');
wp_enqueue_style('crf-style');
wp_enqueue_script('jquery');
wp_enqueue_script('crf_script');
wp_localize_script( 'crf_script', 'MyAjax', array( 'MPF_PATH' => MPF_PATH, 'MPF_URL' => MPF_URL,'ajaxurl' => MPF_URL . 'includes/save-layout.php', 'loadPageLayoutURL' => MPF_URL . 'includes/get-layout.php', 'optionsPageURL' => MPF_URL . 'includes/options.php' ));
}
}
function do_shortcode(){
include('crf_form.php');
}
function options_page() {
// HTML code goes here, left out for brevity
}
function custom_dropdown_page(){
// HTML code goes here, left out for brevity
}
function add_crf_menu_items() {
add_menu_page(
'My Plugin Form',
'MPF',
'manage_options',
'mpf-options',
array(&$this,'options_page')
);
add_submenu_page(
'mpf-options',
'MPF Options',
'MPF Options',
'manage_options',
'custom-mpf-options',
array(&$this,'custom_dropdown_page')
);
}
}
new mpf_plugin();
The paths are all correct. Any ideas as to what is going on?