Support » Plugin: Widgets on Pages » Enqueue the CSS

  • Resolved melriks

    (@melriks)


    Developer Suggestion:

    in widgets_on_pages.php

    Rather than add the CSS directly to the document head.

    Enqueue it. Give other developers a little more control over where the script will load without having to edit the core files directly.

    /* ===============================
      A D D    C S S    ? 
    ================================*/
    function add_wop_css()
    {
    	// echo "<link rel='stylesheet' id='wop-css'  href='".get_settings('siteurl')."/wp-content/plugins/widgets-on-pages/wop.css' type='text/css' media='all' />";
    	wp_register_style('wop-css', 'wp-content/plugins/widgets-on-pages/wop.css', array(), '1.0', 'all');
        wp_enqueue_style('wop-css'); // Enqueue it!
    	
    	}
    
    $options = get_option('wop_options_field');
    $enable_css = $options["enable_css"];
    if ($enable_css) {
      //add_action('wp_head', 'add_wop_css_to_head');
      add_action( 'get_footer', 'add_wop_css' );
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author toddhalfpenny

    (@toddhalfpenny)

    Oh crikey @melriks, sorry, I’ve only just spotted this.
    Thanks for the post, and you’re absolutely right.
    This will be in the next release, for sure.
    Thanks again.

    Plugin Author toddhalfpenny

    (@toddhalfpenny)

    Okey dokey – Implemented and tested and will be in the next release.
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Enqueue the CSS’ is closed to new replies.