Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mehedicsit/acda65fcc40ecea322b3 to your computer and use it in GitHub Desktop.
Save mehedicsit/acda65fcc40ecea322b3 to your computer and use it in GitHub Desktop.
latest enque style and js for wordpress
<?php
function corlate_enque_css_js(){
//Adding CSS files
wp_register_style('bootstrap',get_template_directory_uri() . '/css/bootstrap.min.css',array(),'3.0.3','all');
wp_register_style('font-awesome',get_template_directory_uri() . '/css/font-awesome.min.css',array(),'4.0.3','all');
wp_register_style('animate',get_template_directory_uri() . '/css/animate.min.css',array(),'0.1.9','all');
wp_register_style('prettyPhoto',get_template_directory_uri() . '/css/prettyPhoto.css',array(),'3.1.5','all');
wp_register_style('main',get_template_directory_uri() . '/css/main.css',array(),'1.0.0','all');
wp_register_style('responsive',get_template_directory_uri() . '/css/responsive.css',array(),'1.0.0','all');
// enqueing
wp_enqueue_style( 'bootstrap' );
wp_enqueue_style( 'font-awesome' );
wp_enqueue_style( 'animate' );
wp_enqueue_style( 'prettyPhoto' );
wp_enqueue_style( 'main' );
wp_enqueue_style( 'responsive' );
//Adding Js files
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'bootstrap-js', get_stylesheet_directory_uri() . '/js/bootstrap.min.js',array('jquery'),'3.0.3',true );
wp_enqueue_script( 'prettyPhoto-js', get_stylesheet_directory_uri() . '/js/jquery.prettyPhoto.js',array('jquery'),'3.1.5',true );
wp_enqueue_script( 'isotope-js', get_stylesheet_directory_uri() . '/js/jquery.isotope.min.js',array('jquery'),'1.5.25',true );
wp_enqueue_script( 'main-js', get_stylesheet_directory_uri() . '/js/main.js',array('jquery'),'1.0.0',true );
wp_enqueue_script( 'wow-js', get_stylesheet_directory_uri() . '/js/wow.min.js',array('jquery'),'0.1.9',true );
}
add_action('wp_enqueue_scripts','corlate_enque_css_js');
// add ie conditional html5 shim and respond.js to header
function add_ie_html5_shim () {
if(preg_match('/MSIE [1-8]/i',$_SERVER['HTTP_USER_AGENT'])){
echo "<!--[if lt IE 9]>\n";
echo '<script src="', get_template_directory_uri() .'/js/html5shiv.js"></script>'."\n";
echo '<script src="', get_template_directory_uri() .'/js/respond.min.js"></script>'."\n";
echo "<![endif]-->\n";
}
}
add_action('wp_head', 'add_ie_html5_shim', 50);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment