css - Wordpress: Why isn't my stylesheet being enqueued? -


i'm modifying existing wp plugin making separate plugin extend it. i'd write css override plugin. however, when try enqueue stylesheet doesn't work. know doesn't work because added simple form in includes() , tried style words red in order see change. why isn't working??

note - i'm using action hook plugins_loaded, read in codex happens before wp_enqueue_script. don't suspect enqueueing missing timing, i'm new wp dev correct me if i'm wrong.

update - please see updated css code below. #id selector wasn't coloring text red by itself, when added p (paragraph selector) worked. neither selector worked itself, worked when added both. why this?

find-do-for-anspress.php

if (! defined('wpinc')) {     die; }  class find_do_for_anspress {      /**      * class instance      * @var object      * @since 1.0      */     private static $instance;      /**      * active object instance      *      * @since 1.0      *      * @access public      * @static      * @return object      */     public static function get_instance() {          if ( ! self::$instance ) {             self::$instance = new find_do_for_anspress(); }          return self::$instance;     }     /**      * initialize class      * @since 2.0      */     public function __construct() {          if ( ! class_exists( 'anspress' ) ) {             return; // anspress not installed.         }         if ( ! defined( 'find_do_for_anspress_dir' ) ) {             define( 'find_do_for_anspress_dir', plugin_dir_path( __file__ ) );          }          if ( ! defined( 'find_do_for_anspress_url' ) ) {             define( 'find_do_for_anspress_url', plugin_dir_path( __file__ ) );         }          $this->includes();          add_action( 'wp_enqueue_scripts', array($this, 'fd_enqueue'));   }      private function includes() {          require_once (find_do_for_anspress_dir.'braintree/lib/braintree.php');         require_once (find_do_for_anspress_dir.'fd-braintree/fd-bt-keys.php');         require_once (find_do_for_anspress_dir.'fd-braintree/fd-process-trans.php');         require_once (find_do_for_anspress_dir.'fd-braintree/fd-bt-functions.php');         require_once (find_do_for_anspress_dir.'fd-braintree/fd-bt-form.php');         require_once (find_do_for_anspress_dir.'includes/fd-ask-form.php');        }      public function fd_enqueue() {         wp_enqueue_style( 'fd_for_anspress_css', find_do_for_anspress_dir.'css/fd-css.css', array(jquery), null); //handle, source, dependencies, version, media (the type of media stylesheet designed, e.g. mobile, web, print...)         //wp_enqueue_script( 'fd_for_anspress_js', find_do_for_anspress_dir.'fd-braintree/js/fd-braintree-js.js', array(), null);  used require_once directly add fd-bt-form.php     }   } //end class  function find_do_for_anspress() {     $fdclassstart = new find_do_for_anspress(); } add_action( 'plugins_loaded', 'find_do_for_anspress' );          //html "testing" block         echo '<p id="checkout">testing enqueued css</p>'; 

fd-css.css attempt 1

<style> #checkout {     color: red; } </style> 

fd-css.css attempt 2

<style> #checkout {      color: red; }  p {     color: red; } </style> 

when are calling wp_enqueue_style passing array(jquery) dependency. jquery being invalid handle (it should wrapped in quotes), dependency never loaded, stylesheet isn't loaded

that said, don't want dependencies css. use if wanted control load order of stylesheets, handle place here loaded before script. if handle invalid, script won't loaded.

wp_enqueue_style( 'fd_for_anspress_css', find_do_for_anspress_dir.'css/fd-css.css' ); 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -