options = maybe_unserialize( get_option( THEMESLUG . '_options' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'add_admin_js' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'add_frontend_css' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'add_frontend_js' ) ); } /** * Adding frontend css. * It will be added based on the color palete selected in the wp administrator. */ public function add_frontend_css() { wp_enqueue_style( 'webfonts', 'http://fonts.googleapis.com/css?family=Economica:400,400italic,700,700italic|Lato:400,400italic,300,300italic,700,700italic|Playfair+Display:400,400italic', false, '1.0' ); wp_enqueue_style( 'font_awesome', 'http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css', false, '1.0' ); // Custom Color Palette Style Sheet. $palette_sheet = $this->options['color_palette']; if ( 'light' === $palette_sheet ) { wp_enqueue_style( 'main', CSS_URL .'/main_light.css', false, '1.0' ); } else if ( 'woods' === $palette_sheet ) { wp_enqueue_style( 'main', CSS_URL .'/main_woods.css', false, '1.0' ); } else if ( 'dark' === $palette_sheet ) { wp_enqueue_style( 'main', CSS_URL .'/main_dark.css', false, '1.0' ); } } /** * Adding frontend javascript. */ public function add_frontend_js() { wp_enqueue_script( 'main', JS_URL . '/concatenated/main.min.js', array( 'jquery' ), '1.0', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } /** * Adding javascripts for admin screen * @param string $hook If you want you can use this parameter to define the admin page on which you want to load js. */ public function add_admin_js( $hook ) {} } new Digitalmind_Enqueue_Scripts();