Load CSS / JS Files to WORDPRESS

<?php /* CSS */ function load_styles(){ wp_enqueue_style('main_style', get_stylesheet_uri()); wp_enqueue_style('reset_style', get_template_directory_uri().'/css/reset.css', array(), '1.0', 'all'); } add_action('wp_enqueue_scripts', 'load_styles'); /* JS */ function loadTemplateScripts() { wp_enqueue_script('jquery1', LOVETOEAT_THEME_URL . 'js/jquery-1.9.1.min.js', array(), '1.0', false); wp_enqueue_script('carouFredSel', LOVETOEAT_THEME_URL . 'js/jquery.carouFredSel-6.2.0.js', array(), '1.0', false); } add_action( 'wp_enqueue_scripts', 'loadTemplateScripts'); ?> <?php /* wp_enqueue_style( $handle, $src ); $handle - przyjazna nazwa identyfikatora $src - sciezka do arkusza stylow add_action( 'wp_enqueue_scripts', 'functionName') 'wp_enqueue_scripts' - nazwa hook'a 'functionName' - nazwa naszej funkcji */ ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.