WordPress.org

Ready to get started?Download WordPress

Forums

WP-LESS
[resolved] my wp_enqueue_style is not recognized by wp-less (2 posts)

  1. whootboy
    Member
    Posted 2 years ago #

    Hi,
    I just rewrote a static webpage into a wordpress theme to add several functionalities.

    I set up my styles as recommented. I added the wp_head()-Hook into my <head>.

    wp_register_style( 'myCss', get_bloginfo('template_directory').'/assets/css/style.less', array(), '0.7', 'screen, projection');
    wp_enqueue_style( 'myCss' );

    The commands are processed by WordPress, since the .less-file is in my head with now.
    <link rel='stylesheet' id='myCss-css' href='(xx)/assets/css/style.less?ver=0.7' type='text/css' media='screen, projection' />
    But it seems like it's not recognized by your plugin. I have no idea why. Does my template require another specific hook besides wp_head() or something?!

    I tried it with and without wp_register_style - no difference.

    Any ideas on that?

    http://wordpress.org/extend/plugins/wp-less/

  2. rfros
    Member
    Posted 2 years ago #

    The processing of LESS files happens during the 'wp' action hook. In your functions.php file, include the following:

    function theme_enqueue_less() {
    wp_enqueue_style('myCss', get_bloginfo('template_directory').'/assets/css/style.less', array(), '0.7', 'screen, projection');
    }
    add_action('wp','theme_enqueue_less');

    (apologies for the slew of edits, I had trouble formatting my code)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags