@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
2 | +if ( ! defined('ABSPATH')) return; // Exit if accessed directly |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Enqueue scripts and styles. |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | wp_enqueue_style('lsx_main_style', get_template_directory_uri() . '/style.css', array(), LSX_VERSION); |
14 | 14 | |
15 | - wp_enqueue_style('lsx_main', get_template_directory_uri() . '/css/app.css', array( 'lsx_main_style', 'fontawesome', 'medium-break' ), LSX_VERSION); |
|
15 | + wp_enqueue_style('lsx_main', get_template_directory_uri() . '/css/app.css', array('lsx_main_style', 'fontawesome', 'medium-break'), LSX_VERSION); |
|
16 | 16 | |
17 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
18 | - wp_enqueue_script( 'comment-reply' ); |
|
17 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
18 | + wp_enqueue_script('comment-reply'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/vendor/bootstrap.min.js', array('jquery'), LSX_VERSION, false); |
@@ -26,38 +26,38 @@ discard block |
||
26 | 26 | wp_enqueue_script('picturefill', get_template_directory_uri() . '/js/vendor/picturefill.min.js', array(), LSX_VERSION, false); |
27 | 27 | |
28 | 28 | wp_enqueue_script('masonry'); |
29 | - wp_enqueue_script('imagesLoaded', get_template_directory_uri().'/js/vendor/imagesloaded.pkgd.min.js', array('jquery','masonry'), LSX_VERSION); |
|
30 | - if(defined('WP_DEBUG') && true === WP_DEBUG){ |
|
29 | + wp_enqueue_script('imagesLoaded', get_template_directory_uri() . '/js/vendor/imagesloaded.pkgd.min.js', array('jquery', 'masonry'), LSX_VERSION); |
|
30 | + if (defined('WP_DEBUG') && true === WP_DEBUG) { |
|
31 | 31 | wp_enqueue_script('lsx_script', get_template_directory_uri() . '/js/lsx-script.js', array('masonry'), LSX_VERSION, false); |
32 | - }else{ |
|
32 | + } else { |
|
33 | 33 | wp_enqueue_script('lsx_script', get_template_directory_uri() . '/js/lsx-script.min.js', array('masonry'), LSX_VERSION, false); |
34 | 34 | } |
35 | 35 | |
36 | 36 | //Set some parameters that we can use in the JS |
37 | 37 | $is_portfolio = false; |
38 | - if(is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag') || is_page_template('page-templates/template-portfolio.php')){ |
|
38 | + if (is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag') || is_page_template('page-templates/template-portfolio.php')) { |
|
39 | 39 | $is_portfolio = true; |
40 | 40 | } |
41 | 41 | $param_array = array( |
42 | 42 | 'is_portfolio' => $is_portfolio |
43 | 43 | ); |
44 | 44 | //Set the columns for the archives |
45 | - $param_array['columns'] = apply_filters('lsx_archive_column_number',3); |
|
46 | - wp_localize_script( 'lsx_script', 'lsx_params', $param_array ); |
|
45 | + $param_array['columns'] = apply_filters('lsx_archive_column_number', 3); |
|
46 | + wp_localize_script('lsx_script', 'lsx_params', $param_array); |
|
47 | 47 | |
48 | 48 | |
49 | - wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), LSX_VERSION ); |
|
49 | + wp_enqueue_style('fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), LSX_VERSION); |
|
50 | 50 | |
51 | 51 | |
52 | - if(is_child_theme() && file_exists(get_stylesheet_directory() . '/custom.css')) { |
|
53 | - wp_enqueue_style( 'child-css', get_stylesheet_directory_uri() . '/custom.css', array( 'lsx_main' ), LSX_VERSION ); |
|
52 | + if (is_child_theme() && file_exists(get_stylesheet_directory() . '/custom.css')) { |
|
53 | + wp_enqueue_style('child-css', get_stylesheet_directory_uri() . '/custom.css', array('lsx_main'), LSX_VERSION); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | wp_enqueue_style('medium-break', get_template_directory_uri() . '/css/medium-nav-break.css', array(), LSX_VERSION); |
57 | 57 | |
58 | 58 | |
59 | - $font = get_theme_mod('lsx_font','raleway_open_sans'); |
|
60 | - switch($font){ |
|
59 | + $font = get_theme_mod('lsx_font', 'raleway_open_sans'); |
|
60 | + switch ($font) { |
|
61 | 61 | case 'raleway_open_sans': |
62 | 62 | $header_font_location = 'Raleway'; |
63 | 63 | $body_font_location = 'Open+Sans'; |
@@ -86,18 +86,18 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | $http_var = 'http'; |
89 | - if(is_ssl()){ $http_var .= 's'; } |
|
89 | + if (is_ssl()) { $http_var .= 's'; } |
|
90 | 90 | |
91 | 91 | //Call the Google Fonts and then Enque them. |
92 | - wp_register_style('lsx-header-font', $http_var.'://fonts.googleapis.com/css?family='.$header_font_location); |
|
93 | - wp_register_style('lsx-body-font', $http_var.'://fonts.googleapis.com/css?family='.$body_font_location); |
|
94 | - wp_enqueue_style( 'lsx-header-font' ); |
|
95 | - wp_enqueue_style( 'lsx-body-font' ); |
|
92 | + wp_register_style('lsx-header-font', $http_var . '://fonts.googleapis.com/css?family=' . $header_font_location); |
|
93 | + wp_register_style('lsx-body-font', $http_var . '://fonts.googleapis.com/css?family=' . $body_font_location); |
|
94 | + wp_enqueue_style('lsx-header-font'); |
|
95 | + wp_enqueue_style('lsx-body-font'); |
|
96 | 96 | |
97 | - wp_enqueue_style('lsx_font_scheme', esc_url( get_template_directory_uri() . '/css/'.$font.'.css' ), array(), LSX_VERSION); |
|
97 | + wp_enqueue_style('lsx_font_scheme', esc_url(get_template_directory_uri() . '/css/' . $font . '.css'), array(), LSX_VERSION); |
|
98 | 98 | |
99 | 99 | } |
100 | -add_action( 'wp_enqueue_scripts', 'lsx_scripts' ); |
|
100 | +add_action('wp_enqueue_scripts', 'lsx_scripts'); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Defer JavaScript |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @package lsx |
106 | 106 | * @subpackage scripts |
107 | 107 | */ |
108 | -function lsx_scripts_defer_parsing( $url ) { |
|
109 | - if ( ! ( is_admin() ) ) { |
|
110 | - if ( FALSE === strpos( $url, '.js' ) ) return $url; |
|
111 | - if ( strpos( $url, 'jquery.js' ) ) return $url; |
|
112 | - if ( strpos( $url, ' defer ' ) ) return $url; |
|
108 | +function lsx_scripts_defer_parsing($url) { |
|
109 | + if ( ! (is_admin())) { |
|
110 | + if (FALSE === strpos($url, '.js')) return $url; |
|
111 | + if (strpos($url, 'jquery.js')) return $url; |
|
112 | + if (strpos($url, ' defer ')) return $url; |
|
113 | 113 | return "$url' defer onload='"; |
114 | 114 | } |
115 | 115 | |
116 | 116 | return $url; |
117 | 117 | } |
118 | -add_filter( 'clean_url', 'lsx_scripts_defer_parsing', 11, 1 ); |
|
118 | +add_filter('clean_url', 'lsx_scripts_defer_parsing', 11, 1); |