WordPress.org

Ready to get started?Download WordPress

Forums

Not able to include plugin stylsheet in front end (2 posts)

  1. spstieng
    Member
    Posted 3 years ago #

    I'm trying to include my plugin stylesheet on my WP website (frontend), but for some reason it's not working.

    function init_gallery_scripts() {
      if (is_admin() ) {
        // This works!
        wp_enqueue_script('gallery',  plugins_url('js/gallery.js',__FILE__),array('wp-filebrowser'));
        wp_enqueue_style('gallery-css', plugins_url('style/gallery.css',__FILE__));
      }
      else {
        // This is not woking. Why?
        wp_enqueue_style('gallery-front-css', plugins_url('style/gallery_front.css',__FILE__));
      }
    }

    I've also tried this with no success:

    wp_register_style('gallery-front-css', plugins_url('style/gallery_front.css',__FILE__));
    wp_enqueue_style('gallery-front-css');

    Not sure what I'm doing wrong here.

  2. Michael Fields
    Themer
    Posted 3 years ago #

    What action are you hooking init_gallery_scripts() into?

Topic Closed

This topic has been closed to new replies.

About this Topic