twitter bootstrap - How to integrate bootstrap3.0 with LESS in wordpress? -
twitter bootstrap - How to integrate bootstrap3.0 with LESS in wordpress? -
i able include bootstrap 3.0 css , javascript files help of
wp-bootstrap-navwalker available at:
https://github.com/twittem/wp-bootstrap-navwalker
there wasn't problem when included css file through functions.php
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/resources/bootstrap/css/bootstrap.css', array( ), false, 'all' );
i did similar include less file, didnt work. below code
wp_enqueue_style('jquery', get_template_directory_uri() . '/resources/bootstrap/less/bootstrap.less', array( ), false, 'all' ); wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/resources/bootstrap/js/less-1.3.3.min.js', array( ), false, 'all' );
so speaking, how can integrate bootstrap less file during wordpress theming? (i using underscores starter theme)
i set in functions.php file:
/* * ***********less support******************* */ add_action('init', 'theme_enqueue_styles'); function theme_enqueue_styles() { $template_uri = get_stylesheet_directory_uri(); wp_enqueue_style('style', $template_uri . '/resources/bootstrap/less/bootstrap.less', array(), false, 'all'); } //if using wp-less theme. location based on code above.
in functions have set scripts:
// enqueue javascript if( !function_exists( "theme_js" ) ) {function theme_js(){ wp_register_script( 'bootstrap', get_template_directory_uri() . '/library/js/bootstrap.min.js', array('jquery'), '1.2' ); wp_enqueue_script('bootstrap'); }} add_action( 'wp_enqueue_scripts', 'theme_js' );
now theme using bit different, it's using pattern:
wp_enqueue_script( '_s-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
it seem instead of doing
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/resources/bootstrap/js/less-1.3.3.min.js', array( ), false, 'all' );
it should below:
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/resources/bootstrap/js/less-1.3.3.min.js', array('jquery'), false, false );
correct array should version number (not sure why set in date). false default or auto-generated. jquery added array because bootstrap relies on jquery work. instead of "all" wrong parameter, alternative true or false. true passes footer before end body tag. false puts in head.
lastly should wire wp-less (specifically version: https://github.com/bassjobsen/wp-lesscss). it's simple activating because looks enqueue of less files in functions.
i highly recommend ease issues bootstrap, utilize bootstrap framework 320press or roots. way you're not reinventing wheel :)
wordpress twitter-bootstrap less wordpress-theming
Comments
Post a Comment