@@ -1,53 +1,53 @@ 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 | * Register widgetized area and update sidebar with default widgets. |
| 6 | 6 | */ |
| 7 | 7 | function lsx_widget_area_init() { |
| 8 | 8 | |
| 9 | - register_sidebar( array( |
|
| 10 | - 'name' => __( 'Home', 'lsx' ), |
|
| 9 | + register_sidebar(array( |
|
| 10 | + 'name' => __('Home', 'lsx'), |
|
| 11 | 11 | 'id' => 'sidebar-home', |
| 12 | 12 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
| 13 | 13 | 'after_widget' => '</aside>', |
| 14 | 14 | 'before_title' => '<h3 class="widget-title">', |
| 15 | 15 | 'after_title' => '</h3>', |
| 16 | - ) ); |
|
| 16 | + )); |
|
| 17 | 17 | |
| 18 | - register_sidebar( array( |
|
| 19 | - 'name' => __( 'Sidebar', 'lsx' ), |
|
| 18 | + register_sidebar(array( |
|
| 19 | + 'name' => __('Sidebar', 'lsx'), |
|
| 20 | 20 | 'id' => 'sidebar-1', |
| 21 | 21 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
| 22 | 22 | 'after_widget' => '</aside>', |
| 23 | 23 | 'before_title' => '<h3 class="widget-title">', |
| 24 | 24 | 'after_title' => '</h3>', |
| 25 | - ) ); |
|
| 25 | + )); |
|
| 26 | 26 | |
| 27 | - register_sidebar( array( |
|
| 28 | - 'name' => __( 'Footer', 'lsx' ), |
|
| 27 | + register_sidebar(array( |
|
| 28 | + 'name' => __('Footer', 'lsx'), |
|
| 29 | 29 | 'id' => 'sidebar-footer', |
| 30 | 30 | 'before_widget' => '<div class="styler"><aside id="%1$s" class="widget %2$s">', |
| 31 | 31 | 'after_widget' => '</aside></div>', |
| 32 | 32 | 'before_title' => '<h3 class="widget-title">', |
| 33 | 33 | 'after_title' => '</h3>', |
| 34 | - ) ); |
|
| 34 | + )); |
|
| 35 | 35 | |
| 36 | - register_sidebar( array( |
|
| 37 | - 'name' => __( 'Footer Call to Action', 'lsx' ), |
|
| 36 | + register_sidebar(array( |
|
| 37 | + 'name' => __('Footer Call to Action', 'lsx'), |
|
| 38 | 38 | 'id' => 'sidebar-footer-cta', |
| 39 | 39 | 'before_widget' => '<div class="styler"><aside id="%1$s" class="widget %2$s">', |
| 40 | 40 | 'after_widget' => '</aside></div>', |
| 41 | 41 | 'before_title' => '<h3 class="widget-title">', |
| 42 | 42 | 'after_title' => '</h3>', |
| 43 | - ) ); |
|
| 43 | + )); |
|
| 44 | 44 | } |
| 45 | -add_action( 'widgets_init', 'lsx_widget_area_init' ); |
|
| 45 | +add_action('widgets_init', 'lsx_widget_area_init'); |
|
| 46 | 46 | |
| 47 | -function lsx_sidebar_footer_params( $params ) { |
|
| 47 | +function lsx_sidebar_footer_params($params) { |
|
| 48 | 48 | $sidebar_id = $params[0]['id']; |
| 49 | 49 | |
| 50 | - if ( 'sidebar-footer' == $sidebar_id ) { |
|
| 50 | + if ('sidebar-footer' == $sidebar_id) { |
|
| 51 | 51 | $total_widgets = wp_get_sidebars_widgets(); |
| 52 | 52 | $sidebar_widgets = count($total_widgets[$sidebar_id]); |
| 53 | 53 | |
@@ -56,4 +56,4 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | return $params; |
| 58 | 58 | } |
| 59 | -add_filter( 'dynamic_sidebar_params', 'lsx_sidebar_footer_params' ); |
|
| 60 | 59 | \ No newline at end of file |
| 60 | +add_filter('dynamic_sidebar_params', 'lsx_sidebar_footer_params'); |
|
| 61 | 61 | \ No newline at end of file |
@@ -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 | * Add and remove body_class() classes |
@@ -8,21 +8,21 @@ discard block |
||
| 8 | 8 | /* |
| 9 | 9 | * Add the header layout class |
| 10 | 10 | */ |
| 11 | - $header_layout = get_theme_mod('lsx_header_layout','inline'); |
|
| 12 | - $classes[] = 'header-'.$header_layout; |
|
| 11 | + $header_layout = get_theme_mod('lsx_header_layout', 'inline'); |
|
| 12 | + $classes[] = 'header-' . $header_layout; |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // Add post/page slug |
| 16 | - if (is_single() || is_page() && !is_front_page()) { |
|
| 16 | + if (is_single() || is_page() && ! is_front_page()) { |
|
| 17 | 17 | $classes[] = basename(get_permalink()); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if(!class_exists('Lsx_Banners')){ |
|
| 21 | - $post_types = array('page','post'); |
|
| 22 | - $post_types = apply_filters('lsx_allowed_post_type_banners',$post_types); |
|
| 20 | + if ( ! class_exists('Lsx_Banners')) { |
|
| 21 | + $post_types = array('page', 'post'); |
|
| 22 | + $post_types = apply_filters('lsx_allowed_post_type_banners', $post_types); |
|
| 23 | 23 | |
| 24 | - if((is_singular($post_types) && has_post_thumbnail()) |
|
| 25 | - || (is_singular('jetpack-portfolio'))){ |
|
| 24 | + if ((is_singular($post_types) && has_post_thumbnail()) |
|
| 25 | + || (is_singular('jetpack-portfolio'))) { |
|
| 26 | 26 | $classes[] = 'page-has-banner'; |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $classes[] = 'has-top-menu'; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if ( get_theme_mod( 'lsx_preloader_content_status', '1' ) === '1' ) { |
|
| 34 | + if (get_theme_mod('lsx_preloader_content_status', '1') === '1') { |
|
| 35 | 35 | $classes[] = 'preloader-content-enable'; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -55,30 +55,30 @@ discard block |
||
| 55 | 55 | * @param string $sep Optional separator. |
| 56 | 56 | * @return string The filtered title. |
| 57 | 57 | */ |
| 58 | -function lsx_wp_title( $title, $sep ) { |
|
| 58 | +function lsx_wp_title($title, $sep) { |
|
| 59 | 59 | global $page, $paged; |
| 60 | 60 | |
| 61 | - if ( is_feed() ) { |
|
| 61 | + if (is_feed()) { |
|
| 62 | 62 | return $title; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // Add the blog name |
| 66 | - $title .= get_bloginfo( 'name' ); |
|
| 66 | + $title .= get_bloginfo('name'); |
|
| 67 | 67 | |
| 68 | 68 | // Add the blog description for the home/front page. |
| 69 | - $site_description = get_bloginfo( 'description', 'display' ); |
|
| 70 | - if ( $site_description && ( is_home() || is_front_page() ) ) { |
|
| 69 | + $site_description = get_bloginfo('description', 'display'); |
|
| 70 | + if ($site_description && (is_home() || is_front_page())) { |
|
| 71 | 71 | $title .= " $sep $site_description"; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Add a page number if necessary: |
| 75 | - if ( $paged >= 2 || $page >= 2 ) { |
|
| 76 | - $title .= " $sep " . sprintf( __( 'Page %s', 'lsx' ), max( $paged, $page ) ); |
|
| 75 | + if ($paged >= 2 || $page >= 2) { |
|
| 76 | + $title .= " $sep " . sprintf(__('Page %s', 'lsx'), max($paged, $page)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return $title; |
| 80 | 80 | } |
| 81 | -add_filter( 'wp_title', 'lsx_wp_title', 10, 2 ); |
|
| 81 | +add_filter('wp_title', 'lsx_wp_title', 10, 2); |
|
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | function lsx_remove_self_closing_tags($input) { |
| 100 | 100 | return str_replace(' />', '>', $input); |
| 101 | 101 | } |
| 102 | -add_filter('get_avatar', 'lsx_remove_self_closing_tags'); // <img /> |
|
| 103 | -add_filter('comment_id_fields', 'lsx_remove_self_closing_tags'); // <input /> |
|
| 102 | +add_filter('get_avatar', 'lsx_remove_self_closing_tags'); // <img /> |
|
| 103 | +add_filter('comment_id_fields', 'lsx_remove_self_closing_tags'); // <input /> |
|
| 104 | 104 | add_filter('post_thumbnail_html', 'lsx_remove_self_closing_tags'); // <img /> |
| 105 | 105 | |
| 106 | 106 | |
| 107 | -if (!function_exists('lsx_get_attachment_id')) { |
|
| 107 | +if ( ! function_exists('lsx_get_attachment_id')) { |
|
| 108 | 108 | /** |
| 109 | 109 | * Get the Attachment ID for a given image URL. |
| 110 | 110 | * |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | function lsx_get_attachment_id($url) { |
| 116 | 116 | $dir = wp_upload_dir(); |
| 117 | 117 | // baseurl never has a trailing slash |
| 118 | - if (false === strpos($url, $dir['baseurl'].'/')) { |
|
| 118 | + if (false === strpos($url, $dir['baseurl'] . '/')) { |
|
| 119 | 119 | // URL points to a place outside of upload directory |
| 120 | 120 | return false; |
| 121 | 121 | } |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | $query['meta_query'][0]['key'] = '_wp_attached_file'; |
| 134 | 134 | // query attachments |
| 135 | 135 | $ids = get_posts($query); |
| 136 | - if (!empty($ids)) { |
|
| 136 | + if ( ! empty($ids)) { |
|
| 137 | 137 | foreach ($ids as $id) { |
| 138 | 138 | // first entry of returned array is the URL |
| 139 | - $temp_url = wp_get_attachment_image_src( $id, 'full' ); |
|
| 140 | - if ( array_shift( $temp_url ) === $url ) { |
|
| 139 | + $temp_url = wp_get_attachment_image_src($id, 'full'); |
|
| 140 | + if (array_shift($temp_url) === $url) { |
|
| 141 | 141 | return $id; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | foreach ($ids as $id) { |
| 152 | 152 | $meta = wp_get_attachment_metadata($id); |
| 153 | - foreach ( $meta['sizes'] as $size => $values ) { |
|
| 154 | - if ( $values['file'] === $file && array_shift( wp_get_attachment_image_src( $id, $size ) ) === $url ) { |
|
| 153 | + foreach ($meta['sizes'] as $size => $values) { |
|
| 154 | + if ($values['file'] === $file && array_shift(wp_get_attachment_image_src($id, $size)) === $url) { |
|
| 155 | 155 | return $id; |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | function lsx_is_element_empty($element) { |
| 178 | 178 | $element = trim($element); |
| 179 | - return empty($element)?false:true; |
|
| 179 | + return empty($element) ? false : true; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
@@ -187,39 +187,39 @@ discard block |
||
| 187 | 187 | * @subpackage extras |
| 188 | 188 | * @category thumbnails |
| 189 | 189 | */ |
| 190 | -function lsx_get_thumbnail($size,$image_src = false){ |
|
| 190 | +function lsx_get_thumbnail($size, $image_src = false) { |
|
| 191 | 191 | |
| 192 | - if(false === $image_src){ |
|
| 192 | + if (false === $image_src) { |
|
| 193 | 193 | $post_id = get_the_ID(); |
| 194 | - $post_thumbnail_id = get_post_thumbnail_id( $post_id ); |
|
| 195 | - }elseif(false != $image_src ){ |
|
| 196 | - if(is_numeric($image_src)){ |
|
| 194 | + $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
| 195 | + }elseif (false != $image_src) { |
|
| 196 | + if (is_numeric($image_src)) { |
|
| 197 | 197 | $post_thumbnail_id = $image_src; |
| 198 | - }else{ |
|
| 198 | + } else { |
|
| 199 | 199 | $post_thumbnail_id = lsx_get_attachment_id_from_src($image_src); |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | - $size = apply_filters('lsx_thumbnail_size',$size); |
|
| 202 | + $size = apply_filters('lsx_thumbnail_size', $size); |
|
| 203 | 203 | $img = false; |
| 204 | - if ( 'lsx-thumbnail-wide' === $size || 'thumbnail' === $size ) { |
|
| 204 | + if ('lsx-thumbnail-wide' === $size || 'thumbnail' === $size) { |
|
| 205 | 205 | $srcset = false; |
| 206 | - $img = wp_get_attachment_image_src($post_thumbnail_id,$size); |
|
| 206 | + $img = wp_get_attachment_image_src($post_thumbnail_id, $size); |
|
| 207 | 207 | $img = $img[0]; |
| 208 | 208 | } else { |
| 209 | 209 | $srcset = true; |
| 210 | - $img = wp_get_attachment_image_srcset($post_thumbnail_id,$size); |
|
| 211 | - if ( false == $img ) { |
|
| 210 | + $img = wp_get_attachment_image_srcset($post_thumbnail_id, $size); |
|
| 211 | + if (false == $img) { |
|
| 212 | 212 | $srcset = false; |
| 213 | - $img = wp_get_attachment_image_src($post_thumbnail_id,$size); |
|
| 213 | + $img = wp_get_attachment_image_src($post_thumbnail_id, $size); |
|
| 214 | 214 | $img = $img[0]; |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | - if ( $srcset ) { |
|
| 218 | - $img = '<img alt="'.get_the_title(get_the_ID()).'" class="attachment-responsive wp-post-image lsx-responsive" srcset="'.$img.'" />'; |
|
| 217 | + if ($srcset) { |
|
| 218 | + $img = '<img alt="' . get_the_title(get_the_ID()) . '" class="attachment-responsive wp-post-image lsx-responsive" srcset="' . $img . '" />'; |
|
| 219 | 219 | } else { |
| 220 | - $img = '<img alt="'.get_the_title(get_the_ID()).'" class="attachment-responsive wp-post-image lsx-responsive" src="'.$img.'" />'; |
|
| 220 | + $img = '<img alt="' . get_the_title(get_the_ID()) . '" class="attachment-responsive wp-post-image lsx-responsive" src="' . $img . '" />'; |
|
| 221 | 221 | } |
| 222 | - $img = apply_filters('lsx_lazyload_filter_images',$img); |
|
| 222 | + $img = apply_filters('lsx_lazyload_filter_images', $img); |
|
| 223 | 223 | return $img; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | * @subpackage extras |
| 231 | 231 | * @category thumbnails |
| 232 | 232 | */ |
| 233 | -function lsx_thumbnail( $size = 'thumbnail', $image_src = false ) { |
|
| 234 | - echo wp_kses_post( lsx_get_thumbnail( $size, $image_src ) ); |
|
| 233 | +function lsx_thumbnail($size = 'thumbnail', $image_src = false) { |
|
| 234 | + echo wp_kses_post(lsx_get_thumbnail($size, $image_src)); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
@@ -241,13 +241,13 @@ discard block |
||
| 241 | 241 | * @subpackage extras |
| 242 | 242 | * @category thumbnails |
| 243 | 243 | */ |
| 244 | -function lsx_get_attachment_id_from_src( $image_src ) { |
|
| 245 | - $post_id = wp_cache_get( $image_src, 'lsx_get_attachment_id_from_src' ); |
|
| 244 | +function lsx_get_attachment_id_from_src($image_src) { |
|
| 245 | + $post_id = wp_cache_get($image_src, 'lsx_get_attachment_id_from_src'); |
|
| 246 | 246 | |
| 247 | - if ( false === $post_id ) { |
|
| 247 | + if (false === $post_id) { |
|
| 248 | 248 | global $wpdb; |
| 249 | - $post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src ) ); |
|
| 250 | - wp_cache_set( $image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600 ); |
|
| 249 | + $post_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src)); |
|
| 250 | + wp_cache_set($image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | return $post_id; |
@@ -261,28 +261,28 @@ discard block |
||
| 261 | 261 | * @subpackage extras |
| 262 | 262 | * @category banner |
| 263 | 263 | */ |
| 264 | -if (!function_exists('lsx_page_banner')) { |
|
| 264 | +if ( ! function_exists('lsx_page_banner')) { |
|
| 265 | 265 | function lsx_page_banner() { |
| 266 | 266 | |
| 267 | - $post_types = array('page','post'); |
|
| 268 | - $post_types = apply_filters('lsx_allowed_post_type_banners',$post_types); |
|
| 267 | + $post_types = array('page', 'post'); |
|
| 268 | + $post_types = apply_filters('lsx_allowed_post_type_banners', $post_types); |
|
| 269 | 269 | |
| 270 | - if ( (is_singular($post_types) && has_post_thumbnail()) |
|
| 271 | - || (is_singular('jetpack-portfolio')) ) { ?> |
|
| 270 | + if ((is_singular($post_types) && has_post_thumbnail()) |
|
| 271 | + || (is_singular('jetpack-portfolio'))) { ?> |
|
| 272 | 272 | |
| 273 | 273 | <?php |
| 274 | 274 | $bg_image = ''; |
| 275 | - if(has_post_thumbnail()){ |
|
| 276 | - $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full'); |
|
| 275 | + if (has_post_thumbnail()) { |
|
| 276 | + $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); |
|
| 277 | 277 | $bg_image = $bg_image[0]; |
| 278 | 278 | } |
| 279 | 279 | ?> |
| 280 | 280 | |
| 281 | - <?php if ( ! empty( $bg_image ) ) : ?> |
|
| 281 | + <?php if ( ! empty($bg_image)) : ?> |
|
| 282 | 282 | |
| 283 | 283 | <div class="page-banner-wrap"> |
| 284 | 284 | <div class="page-banner"> |
| 285 | - <div class="page-banner-image" style="background-image:url(<?php echo esc_attr( $bg_image ); ?>);"></div> |
|
| 285 | + <div class="page-banner-image" style="background-image:url(<?php echo esc_attr($bg_image); ?>);"></div> |
|
| 286 | 286 | |
| 287 | 287 | <div class="container"> |
| 288 | 288 | <header class="page-header"> |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | <?php } |
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | -add_action( 'lsx_header_after', 'lsx_page_banner' ); |
|
| 301 | +add_action('lsx_header_after', 'lsx_page_banner'); |
|
| 302 | 302 | |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -308,43 +308,43 @@ discard block |
||
| 308 | 308 | * @subpackage extras |
| 309 | 309 | * @category mobile |
| 310 | 310 | */ |
| 311 | -function lsx_allow_sms_protocol( $protocols ) { |
|
| 311 | +function lsx_allow_sms_protocol($protocols) { |
|
| 312 | 312 | $protocols[] = 'sms'; |
| 313 | 313 | return $protocols; |
| 314 | 314 | } |
| 315 | -add_filter( 'kses_allowed_protocols', 'lsx_allow_sms_protocol' ); |
|
| 315 | +add_filter('kses_allowed_protocols', 'lsx_allow_sms_protocol'); |
|
| 316 | 316 | |
| 317 | 317 | |
| 318 | 318 | /** |
| 319 | 319 | * Adding browser and user-agent classes to body |
| 320 | 320 | */ |
| 321 | 321 | function mv_browser_body_class($classes) { |
| 322 | - $http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); |
|
| 323 | - $http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : ''; |
|
| 322 | + $http_user_agent = sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])); |
|
| 323 | + $http_user_agent = ! empty($http_user_agent) ? $http_user_agent : ''; |
|
| 324 | 324 | |
| 325 | 325 | global $is_lynx, $is_gecko, $is_ie, $is_opera, $is_ns4, $is_safari, $is_chrome, $is_iphone; |
| 326 | - if($is_lynx) $classes[] = 'lynx'; |
|
| 327 | - elseif($is_gecko) $classes[] = 'gecko'; |
|
| 328 | - elseif($is_opera) $classes[] = 'opera'; |
|
| 329 | - elseif($is_ns4) $classes[] = 'ns4'; |
|
| 330 | - elseif($is_safari) $classes[] = 'safari'; |
|
| 331 | - elseif($is_chrome) $classes[] = 'chrome'; |
|
| 332 | - elseif($is_ie) { |
|
| 326 | + if ($is_lynx) $classes[] = 'lynx'; |
|
| 327 | + elseif ($is_gecko) $classes[] = 'gecko'; |
|
| 328 | + elseif ($is_opera) $classes[] = 'opera'; |
|
| 329 | + elseif ($is_ns4) $classes[] = 'ns4'; |
|
| 330 | + elseif ($is_safari) $classes[] = 'safari'; |
|
| 331 | + elseif ($is_chrome) $classes[] = 'chrome'; |
|
| 332 | + elseif ($is_ie) { |
|
| 333 | 333 | $classes[] = 'ie'; |
| 334 | - if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) |
|
| 335 | - $classes[] = 'ie'.$browser_version[1]; |
|
| 334 | + if (preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) |
|
| 335 | + $classes[] = 'ie' . $browser_version[1]; |
|
| 336 | 336 | } else $classes[] = 'unknown'; |
| 337 | - if($is_iphone) $classes[] = 'iphone'; |
|
| 338 | - if ( stristr( $http_user_agent, "mac") ) { |
|
| 337 | + if ($is_iphone) $classes[] = 'iphone'; |
|
| 338 | + if (stristr($http_user_agent, "mac")) { |
|
| 339 | 339 | $classes[] = 'osx'; |
| 340 | - } elseif ( stristr( $http_user_agent, "linux") ) { |
|
| 340 | + } elseif (stristr($http_user_agent, "linux")) { |
|
| 341 | 341 | $classes[] = 'linux'; |
| 342 | - } elseif ( stristr( $http_user_agent, "windows") ) { |
|
| 342 | + } elseif (stristr($http_user_agent, "windows")) { |
|
| 343 | 343 | $classes[] = 'windows'; |
| 344 | 344 | } |
| 345 | 345 | return $classes; |
| 346 | 346 | } |
| 347 | -add_filter('body_class','mv_browser_body_class'); |
|
| 347 | +add_filter('body_class', 'mv_browser_body_class'); |
|
| 348 | 348 | |
| 349 | 349 | |
| 350 | 350 | /** |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | * @param $form Object |
| 358 | 358 | * @return String |
| 359 | 359 | */ |
| 360 | -function lsx_form_submit_button($button, $form){ |
|
| 360 | +function lsx_form_submit_button($button, $form) { |
|
| 361 | 361 | return "<button class='btn btn-primary' id='gform_submit_button_{$form["id"]}'><span>Submit</span></button>"; |
| 362 | 362 | } |
| 363 | 363 | add_filter("gform_submit_button", "lsx_form_submit_button", 10, 2); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | //return ' ... <a class="moretag" href="'. get_permalink($post->ID) . '">'.__('Continue reading','lsx').'</a>'; |
| 372 | 372 | return '...'; |
| 373 | 373 | } |
| 374 | -add_filter( 'excerpt_more', 'lsx_excerpt_more' ); |
|
| 374 | +add_filter('excerpt_more', 'lsx_excerpt_more'); |
|
| 375 | 375 | |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -380,44 +380,44 @@ discard block |
||
| 380 | 380 | function lsx_the_excerpt_filter($excerpt) { |
| 381 | 381 | $show_full_content = has_post_format(apply_filters('lsx_the_excerpt_filter_post_types', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio'))); |
| 382 | 382 | |
| 383 | - if (!$show_full_content) { |
|
| 384 | - if ('' !== $excerpt && !stristr($excerpt, 'moretag')) { |
|
| 385 | - $pagination = wp_link_pages( array( |
|
| 383 | + if ( ! $show_full_content) { |
|
| 384 | + if ('' !== $excerpt && ! stristr($excerpt, 'moretag')) { |
|
| 385 | + $pagination = wp_link_pages(array( |
|
| 386 | 386 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
| 387 | 387 | 'after' => '</div></div>', |
| 388 | 388 | 'link_before' => '<span>', |
| 389 | 389 | 'link_after' => '</span>', |
| 390 | 390 | 'echo' => 0 |
| 391 | - ) ); |
|
| 391 | + )); |
|
| 392 | 392 | |
| 393 | - if ( ! empty( $pagination ) ) { |
|
| 393 | + if ( ! empty($pagination)) { |
|
| 394 | 394 | $excerpt .= $pagination; |
| 395 | 395 | } |
| 396 | 396 | else { |
| 397 | - $excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.__('Continue reading','lsx').'</a></p>'; |
|
| 397 | + $excerpt .= '<p><a class="moretag" href="' . get_permalink() . '">' . __('Continue reading', 'lsx') . '</a></p>'; |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | return $excerpt; |
| 403 | 403 | } |
| 404 | -add_filter( 'the_excerpt', 'lsx_the_excerpt_filter' , 1 , 20 ); |
|
| 404 | +add_filter('the_excerpt', 'lsx_the_excerpt_filter', 1, 20); |
|
| 405 | 405 | |
| 406 | 406 | |
| 407 | 407 | /** |
| 408 | 408 | * Allow HTML tags in excerpt |
| 409 | 409 | */ |
| 410 | -if ( ! function_exists( 'wpse_custom_wp_trim_excerpt' ) ) { |
|
| 410 | +if ( ! function_exists('wpse_custom_wp_trim_excerpt')) { |
|
| 411 | 411 | function wpse_custom_wp_trim_excerpt($wpse_excerpt) { |
| 412 | 412 | global $post; |
| 413 | 413 | $raw_excerpt = $wpse_excerpt; |
| 414 | 414 | |
| 415 | - if ( '' == $wpse_excerpt ) { |
|
| 415 | + if ('' == $wpse_excerpt) { |
|
| 416 | 416 | $wpse_excerpt = get_the_content(''); |
| 417 | 417 | $show_full_content = has_post_format(array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio')); |
| 418 | 418 | |
| 419 | - if (!$show_full_content) { |
|
| 420 | - $wpse_excerpt = strip_shortcodes( $wpse_excerpt ); |
|
| 419 | + if ( ! $show_full_content) { |
|
| 420 | + $wpse_excerpt = strip_shortcodes($wpse_excerpt); |
|
| 421 | 421 | $wpse_excerpt = apply_filters('the_content', $wpse_excerpt); |
| 422 | 422 | $wpse_excerpt = str_replace(']]>', ']]>', $wpse_excerpt); |
| 423 | 423 | //$wpse_excerpt = strip_tags($wpse_excerpt, '<blockquote>,<p>'); |
@@ -445,12 +445,12 @@ discard block |
||
| 445 | 445 | $wpse_excerpt = trim(force_balance_tags($excerpt_output)); |
| 446 | 446 | |
| 447 | 447 | if ($has_more) { |
| 448 | - $excerpt_end = '<a class="moretag" href="'.get_permalink().'">'.__('More','lsx').'</a>'; |
|
| 448 | + $excerpt_end = '<a class="moretag" href="' . get_permalink() . '">' . __('More', 'lsx') . '</a>'; |
|
| 449 | 449 | $excerpt_end = apply_filters('excerpt_more', ' ' . $excerpt_end); |
| 450 | 450 | |
| 451 | 451 | $pos = strrpos($wpse_excerpt, '</'); |
| 452 | 452 | |
| 453 | - if ( false !== $pos ) { |
|
| 453 | + if (false !== $pos) { |
|
| 454 | 454 | // Inside last HTML tag |
| 455 | 455 | $wpse_excerpt = substr_replace($wpse_excerpt, $excerpt_end, $pos, 0); /* Add read more next to last word */ |
| 456 | 456 | } else { |
@@ -473,4 +473,4 @@ discard block |
||
| 473 | 473 | } |
| 474 | 474 | remove_filter('get_the_excerpt', 'wp_trim_excerpt'); |
| 475 | 475 | add_filter('get_the_excerpt', 'wpse_custom_wp_trim_excerpt'); |
| 476 | -remove_filter( 'the_excerpt', 'wpautop' ); |
|
| 476 | +remove_filter('the_excerpt', 'wpautop'); |
|
@@ -1,5 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + return; |
|
| 4 | +} |
|
| 5 | +// Exit if accessed directly |
|
| 3 | 6 | |
| 4 | 7 | /** |
| 5 | 8 | * Add and remove body_class() classes |
@@ -192,10 +195,10 @@ discard block |
||
| 192 | 195 | if(false === $image_src){ |
| 193 | 196 | $post_id = get_the_ID(); |
| 194 | 197 | $post_thumbnail_id = get_post_thumbnail_id( $post_id ); |
| 195 | - }elseif(false != $image_src ){ |
|
| 198 | + } elseif(false != $image_src ){ |
|
| 196 | 199 | if(is_numeric($image_src)){ |
| 197 | 200 | $post_thumbnail_id = $image_src; |
| 198 | - }else{ |
|
| 201 | + } else{ |
|
| 199 | 202 | $post_thumbnail_id = lsx_get_attachment_id_from_src($image_src); |
| 200 | 203 | } |
| 201 | 204 | } |
@@ -323,18 +326,29 @@ discard block |
||
| 323 | 326 | $http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : ''; |
| 324 | 327 | |
| 325 | 328 | global $is_lynx, $is_gecko, $is_ie, $is_opera, $is_ns4, $is_safari, $is_chrome, $is_iphone; |
| 326 | - if($is_lynx) $classes[] = 'lynx'; |
|
| 327 | - elseif($is_gecko) $classes[] = 'gecko'; |
|
| 328 | - elseif($is_opera) $classes[] = 'opera'; |
|
| 329 | - elseif($is_ns4) $classes[] = 'ns4'; |
|
| 330 | - elseif($is_safari) $classes[] = 'safari'; |
|
| 331 | - elseif($is_chrome) $classes[] = 'chrome'; |
|
| 332 | - elseif($is_ie) { |
|
| 329 | + if($is_lynx) { |
|
| 330 | + $classes[] = 'lynx'; |
|
| 331 | + } elseif($is_gecko) { |
|
| 332 | + $classes[] = 'gecko'; |
|
| 333 | + } elseif($is_opera) { |
|
| 334 | + $classes[] = 'opera'; |
|
| 335 | + } elseif($is_ns4) { |
|
| 336 | + $classes[] = 'ns4'; |
|
| 337 | + } elseif($is_safari) { |
|
| 338 | + $classes[] = 'safari'; |
|
| 339 | + } elseif($is_chrome) { |
|
| 340 | + $classes[] = 'chrome'; |
|
| 341 | + } elseif($is_ie) { |
|
| 333 | 342 | $classes[] = 'ie'; |
| 334 | - if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) |
|
| 335 | - $classes[] = 'ie'.$browser_version[1]; |
|
| 336 | - } else $classes[] = 'unknown'; |
|
| 337 | - if($is_iphone) $classes[] = 'iphone'; |
|
| 343 | + if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) { |
|
| 344 | + $classes[] = 'ie'.$browser_version[1]; |
|
| 345 | + } |
|
| 346 | + } else { |
|
| 347 | + $classes[] = 'unknown'; |
|
| 348 | + } |
|
| 349 | + if($is_iphone) { |
|
| 350 | + $classes[] = 'iphone'; |
|
| 351 | + } |
|
| 338 | 352 | if ( stristr( $http_user_agent, "mac") ) { |
| 339 | 353 | $classes[] = 'osx'; |
| 340 | 354 | } elseif ( stristr( $http_user_agent, "linux") ) { |
@@ -392,8 +406,7 @@ discard block |
||
| 392 | 406 | |
| 393 | 407 | if ( ! empty( $pagination ) ) { |
| 394 | 408 | $excerpt .= $pagination; |
| 395 | - } |
|
| 396 | - else { |
|
| 409 | + } else { |
|
| 397 | 410 | $excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.__('Continue reading','lsx').'</a></p>'; |
| 398 | 411 | } |
| 399 | 412 | } |
@@ -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 | * Theme Configuration File |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @package lsx |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -if ( ! function_exists( 'lsx_setup' ) ) : |
|
| 11 | +if ( ! function_exists('lsx_setup')) : |
|
| 12 | 12 | /** |
| 13 | 13 | * Sets up theme defaults and registers support for various WordPress features. |
| 14 | 14 | * |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | function lsx_setup() { |
| 20 | 20 | global $content_width; |
| 21 | 21 | |
| 22 | - load_theme_textdomain( 'lsx', get_template_directory() . '/languages' ); |
|
| 22 | + load_theme_textdomain('lsx', get_template_directory() . '/languages'); |
|
| 23 | 23 | |
| 24 | 24 | $args = array( |
| 25 | 25 | 'header-text' => array( |
@@ -28,50 +28,50 @@ discard block |
||
| 28 | 28 | ), |
| 29 | 29 | 'size' => 'medium', |
| 30 | 30 | ); |
| 31 | - add_theme_support( 'site-logo', $args ); |
|
| 31 | + add_theme_support('site-logo', $args); |
|
| 32 | 32 | |
| 33 | - add_theme_support( 'custom-logo', array( |
|
| 33 | + add_theme_support('custom-logo', array( |
|
| 34 | 34 | 'height' => 50, |
| 35 | 35 | 'width' => 150, |
| 36 | 36 | 'flex-width' => true, |
| 37 | 37 | 'flex-height' => true, |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - add_theme_support( 'automatic-feed-links' ); |
|
| 41 | - add_theme_support( 'title-tag' ); |
|
| 42 | - add_theme_support( 'post-thumbnails' ); |
|
| 43 | - add_theme_support( 'post-formats', array('image', 'video', 'gallery', 'audio', 'link', 'quote', 'aside') ); |
|
| 40 | + add_theme_support('automatic-feed-links'); |
|
| 41 | + add_theme_support('title-tag'); |
|
| 42 | + add_theme_support('post-thumbnails'); |
|
| 43 | + add_theme_support('post-formats', array('image', 'video', 'gallery', 'audio', 'link', 'quote', 'aside')); |
|
| 44 | 44 | |
| 45 | 45 | // This theme uses wp_nav_menu() in one location. |
| 46 | - register_nav_menus( array( |
|
| 47 | - 'primary' => __( 'Primary Menu', 'lsx' ), |
|
| 48 | - 'top-menu'=> __( 'Top Menu' , 'lsx' ), |
|
| 49 | - 'social'=> __( 'Social Menu' , 'lsx' ), |
|
| 50 | - 'footer'=> __( 'Footer Menu' , 'lsx' ) |
|
| 51 | - ) ); |
|
| 46 | + register_nav_menus(array( |
|
| 47 | + 'primary' => __('Primary Menu', 'lsx'), |
|
| 48 | + 'top-menu'=> __('Top Menu', 'lsx'), |
|
| 49 | + 'social'=> __('Social Menu', 'lsx'), |
|
| 50 | + 'footer'=> __('Footer Menu', 'lsx') |
|
| 51 | + )); |
|
| 52 | 52 | |
| 53 | 53 | //Set the content width |
| 54 | 54 | $content_width = 1140; |
| 55 | 55 | |
| 56 | - add_editor_style( get_template_directory_uri() . '/css/editor-style.css' ); |
|
| 57 | - add_theme_support( 'html5', array( 'caption' ) ); |
|
| 56 | + add_editor_style(get_template_directory_uri() . '/css/editor-style.css'); |
|
| 57 | + add_theme_support('html5', array('caption')); |
|
| 58 | 58 | |
| 59 | - add_theme_support( 'woocommerce' ); |
|
| 60 | - add_theme_support( 'sensei' ); |
|
| 59 | + add_theme_support('woocommerce'); |
|
| 60 | + add_theme_support('sensei'); |
|
| 61 | 61 | } |
| 62 | 62 | endif; // lsx_setup |
| 63 | -add_action( 'after_setup_theme', 'lsx_setup' ); |
|
| 63 | +add_action('after_setup_theme', 'lsx_setup'); |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Removes the "Custom Fields" meta box. |
| 67 | 67 | */ |
| 68 | 68 | function lsx_remove_meta_boxes() { |
| 69 | 69 | $post_types = get_post_types(); |
| 70 | - foreach($post_types as $post_type){ |
|
| 71 | - remove_meta_box( 'postcustom' , $post_type , 'normal' ); |
|
| 70 | + foreach ($post_types as $post_type) { |
|
| 71 | + remove_meta_box('postcustom', $post_type, 'normal'); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | -add_action( 'admin_menu' , 'lsx_remove_meta_boxes' ); |
|
| 74 | +add_action('admin_menu', 'lsx_remove_meta_boxes'); |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * Overwrite the $content_width var, based on the layout of the page. |
@@ -83,33 +83,33 @@ discard block |
||
| 83 | 83 | function lsx_process_content_width() { |
| 84 | 84 | global $content_width; |
| 85 | 85 | |
| 86 | - if( |
|
| 86 | + if ( |
|
| 87 | 87 | is_page_template('page-templates/template-portfolio.php') || |
| 88 | 88 | is_page_template('page-templates/template-front-page.php') || |
| 89 | 89 | is_page_template('page-templates/template-full-width.php') || |
| 90 | 90 | is_post_type_archive('jetpack-portfolio') || |
| 91 | - is_tax(array('jetpack-portfolio-type','jetpack-portfolio-tag')) || |
|
| 91 | + is_tax(array('jetpack-portfolio-type', 'jetpack-portfolio-tag')) || |
|
| 92 | 92 | is_singular('jetpack-portfolio') |
| 93 | - ){ |
|
| 93 | + ) { |
|
| 94 | 94 | $content_width = 1140; |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | -add_action('wp_head','lsx_process_content_width'); |
|
| 97 | +add_action('wp_head', 'lsx_process_content_width'); |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Disable the comments form by default for the page post type. |
| 101 | 101 | * @package lsx |
| 102 | 102 | * @subpackage config |
| 103 | 103 | */ |
| 104 | -function lsx_page_comments_off( $data ) { |
|
| 105 | - if ( 'page' == $data['post_type'] && 'auto-draft' == $data['post_status'] && esc_html__( 'Auto Draft', 'lsx' ) == $data['post_title'] ) { |
|
| 104 | +function lsx_page_comments_off($data) { |
|
| 105 | + if ('page' == $data['post_type'] && 'auto-draft' == $data['post_status'] && esc_html__('Auto Draft', 'lsx') == $data['post_title']) { |
|
| 106 | 106 | $data['comment_status'] = 0; |
| 107 | 107 | $data['ping_status'] = 0; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return $data; |
| 111 | 111 | } |
| 112 | -add_filter( 'wp_insert_post_data', 'lsx_page_comments_off' ); |
|
| 112 | +add_filter('wp_insert_post_data', 'lsx_page_comments_off'); |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * Disable the comments form by default for the page post type. |
@@ -117,14 +117,14 @@ discard block |
||
| 117 | 117 | * @subpackage config |
| 118 | 118 | */ |
| 119 | 119 | function lsx_is_legacy($data) { |
| 120 | - if ( 'page' == $data['post_type'] && 'auto-draft' == $data['post_status'] && esc_html__( 'Auto Draft', 'lsx' ) == $data['post_title'] ) { |
|
| 120 | + if ('page' == $data['post_type'] && 'auto-draft' == $data['post_status'] && esc_html__('Auto Draft', 'lsx') == $data['post_title']) { |
|
| 121 | 121 | $data['comment_status'] = 0; |
| 122 | 122 | $data['ping_status'] = 0; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $data; |
| 126 | 126 | } |
| 127 | -add_filter( 'wp_insert_post_data', 'lsx_page_comments_off' ); |
|
| 127 | +add_filter('wp_insert_post_data', 'lsx_page_comments_off'); |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * Run the init command |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | * @subpackage config |
| 133 | 133 | */ |
| 134 | 134 | function lsx_init() { |
| 135 | - if(class_exists('WooCommerce')){ |
|
| 136 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); |
|
| 135 | + if (class_exists('WooCommerce')) { |
|
| 136 | + remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | -add_action( 'init', 'lsx_init',100 ); |
|
| 139 | +add_action('init', 'lsx_init', 100); |
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * Run on the wp_head |
@@ -145,11 +145,11 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | function lsx_wp_head() { |
| 147 | 147 | |
| 148 | - $layout = get_theme_mod('lsx_layout','2cr'); |
|
| 149 | - $layout = apply_filters( 'lsx_layout', $layout ); |
|
| 148 | + $layout = get_theme_mod('lsx_layout', '2cr'); |
|
| 149 | + $layout = apply_filters('lsx_layout', $layout); |
|
| 150 | 150 | |
| 151 | - if('1c' === $layout && (is_author() || is_search() || (is_post_type_archive(array('post','page','jetpack-portfolio')) && !is_post_type_archive('tribe_events')) || is_tag() || is_category() || is_date() || is_tax('post_format')) ){ |
|
| 152 | - remove_action('lsx_content_top', 'lsx_breadcrumbs', 100 ); |
|
| 151 | + if ('1c' === $layout && (is_author() || is_search() || (is_post_type_archive(array('post', 'page', 'jetpack-portfolio')) && ! is_post_type_archive('tribe_events')) || is_tag() || is_category() || is_date() || is_tax('post_format'))) { |
|
| 152 | + remove_action('lsx_content_top', 'lsx_breadcrumbs', 100); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | -add_action( 'wp_head', 'lsx_wp_head',100 ); |
|
| 155 | +add_action('wp_head', 'lsx_wp_head', 100); |
|
@@ -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 | * Layout hooks |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | * @package lsx |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -function lsx_layout_selector( $class, $area = 'site' ) { |
|
| 10 | +function lsx_layout_selector($class, $area = 'site') { |
|
| 11 | 11 | |
| 12 | - $layout = get_theme_mod('lsx_layout','2cr'); |
|
| 13 | - $layout = apply_filters( 'lsx_layout', $layout ); |
|
| 12 | + $layout = get_theme_mod('lsx_layout', '2cr'); |
|
| 13 | + $layout = apply_filters('lsx_layout', $layout); |
|
| 14 | 14 | |
| 15 | 15 | $default_size = 'sm'; |
| 16 | - $size = apply_filters( 'lsx_bootstrap_column_size', $default_size ); |
|
| 16 | + $size = apply_filters('lsx_bootstrap_column_size', $default_size); |
|
| 17 | 17 | |
| 18 | - switch ( $layout ) { |
|
| 18 | + switch ($layout) { |
|
| 19 | 19 | case '1c': |
| 20 | 20 | $main_class = 'col-' . $size . '-12'; |
| 21 | 21 | $sidebar_class = 'col-' . $size . '-12'; |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | break; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if ( 'main' == $class ) { |
|
| 37 | + if ('main' == $class) { |
|
| 38 | 38 | return $main_class; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if ( 'sidebar' == $class ) { |
|
| 41 | + if ('sidebar' == $class) { |
|
| 42 | 42 | return $sidebar_class; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * .main classes |
| 48 | 48 | */ |
| 49 | 49 | function lsx_main_class() { |
| 50 | - return lsx_layout_selector( 'main' ); |
|
| 50 | + return lsx_layout_selector('main'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | function lsx_home_main_class() { |
| 54 | - return lsx_layout_selector( 'main', 'home' ); |
|
| 54 | + return lsx_layout_selector('main', 'home'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | function lsx_index_main_class() { |
| 61 | 61 | |
| 62 | 62 | $show_on_front = get_option('show_on_front'); |
| 63 | - if('page' == $show_on_front){ |
|
| 64 | - return lsx_layout_selector( 'main', 'home' ); |
|
| 65 | - }else{ |
|
| 66 | - return lsx_layout_selector( 'main', 'site' ); |
|
| 63 | + if ('page' == $show_on_front) { |
|
| 64 | + return lsx_layout_selector('main', 'home'); |
|
| 65 | + } else { |
|
| 66 | + return lsx_layout_selector('main', 'site'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | } |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | * .sidebar classes |
| 73 | 73 | */ |
| 74 | 74 | function lsx_sidebar_class() { |
| 75 | - return lsx_layout_selector( 'sidebar' ); |
|
| 75 | + return lsx_layout_selector('sidebar'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | function lsx_home_sidebar_class() { |
| 79 | - return lsx_layout_selector( 'sidebar', 'home' ); |
|
| 79 | + return lsx_layout_selector('sidebar', 'home'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | $classes = 'banner navbar navbar-default'; |
| 92 | 92 | |
| 93 | 93 | //Fixed header |
| 94 | - $fixed_header = get_theme_mod('lsx_header_fixed',false); |
|
| 95 | - if(false != $fixed_header){ |
|
| 94 | + $fixed_header = get_theme_mod('lsx_header_fixed', false); |
|
| 95 | + if (false != $fixed_header) { |
|
| 96 | 96 | $classes .= ' navbar-static-top'; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if(false != $additional){ |
|
| 100 | - $classes .= ' '.$additional; |
|
| 99 | + if (false != $additional) { |
|
| 100 | + $classes .= ' ' . $additional; |
|
| 101 | 101 | } |
| 102 | - echo esc_attr( $classes ); |
|
| 102 | + echo esc_attr($classes); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -114,37 +114,37 @@ discard block |
||
| 114 | 114 | $classes = 'top-menu-default'; |
| 115 | 115 | |
| 116 | 116 | //Fixed header |
| 117 | - $fixed_header = get_theme_mod('lsx_header_fixed',false); |
|
| 118 | - if(false != $fixed_header){ |
|
| 117 | + $fixed_header = get_theme_mod('lsx_header_fixed', false); |
|
| 118 | + if (false != $fixed_header) { |
|
| 119 | 119 | $classes .= ' top-menu-fixed'; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if(false != $additional){ |
|
| 123 | - $classes .= ' '.$additional; |
|
| 122 | + if (false != $additional) { |
|
| 123 | + $classes .= ' ' . $additional; |
|
| 124 | 124 | } |
| 125 | - echo esc_attr( $classes ); |
|
| 125 | + echo esc_attr($classes); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | -add_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
| 129 | -if ( ! function_exists( 'lsx_add_footer_sidebar_area' ) ) { |
|
| 128 | +add_action('lsx_footer_before', 'lsx_add_footer_sidebar_area'); |
|
| 129 | +if ( ! function_exists('lsx_add_footer_sidebar_area')) { |
|
| 130 | 130 | function lsx_add_footer_sidebar_area() { |
| 131 | - if ( is_active_sidebar( 'sidebar-footer-cta' ) ) : ?> |
|
| 131 | + if (is_active_sidebar('sidebar-footer-cta')) : ?> |
|
| 132 | 132 | <div id="footer-cta"> |
| 133 | 133 | <div class="container"> |
| 134 | 134 | <div class="lsx-full-width"> |
| 135 | 135 | <div class="lsx-hero-unit"> |
| 136 | - <?php dynamic_sidebar( 'sidebar-footer-cta' ); ?> |
|
| 136 | + <?php dynamic_sidebar('sidebar-footer-cta'); ?> |
|
| 137 | 137 | </div> |
| 138 | 138 | </div> |
| 139 | 139 | </div> |
| 140 | 140 | </div> |
| 141 | 141 | <?php endif; ?> |
| 142 | 142 | |
| 143 | - <?php if ( is_active_sidebar( 'sidebar-footer' ) ) : ?> |
|
| 143 | + <?php if (is_active_sidebar('sidebar-footer')) : ?> |
|
| 144 | 144 | <div id="footer-widgets"> |
| 145 | 145 | <div class="container"> |
| 146 | 146 | <div class="row"> |
| 147 | - <?php dynamic_sidebar( 'sidebar-footer' ); ?> |
|
| 147 | + <?php dynamic_sidebar('sidebar-footer'); ?> |
|
| 148 | 148 | </div> |
| 149 | 149 | </div> |
| 150 | 150 | </div> |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | <?php |
| 168 | 168 | else*/if (is_singular('post')) : |
| 169 | 169 | $format = get_post_format(); |
| 170 | - if ( false === $format ) { |
|
| 170 | + if (false === $format) { |
|
| 171 | 171 | $format = 'standard'; |
| 172 | 172 | } |
| 173 | 173 | $format_link = get_post_format_link($format); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | ?> |
| 176 | 176 | <header class="archive-header"> |
| 177 | 177 | <h1 class="archive-title"> |
| 178 | - <i class="format-link fa fa-<?php echo esc_attr( $format ) ?>"></i> |
|
| 178 | + <i class="format-link fa fa-<?php echo esc_attr($format) ?>"></i> |
|
| 179 | 179 | <span><?php the_title(); ?></span> |
| 180 | 180 | </h1> |
| 181 | 181 | </header> |
@@ -189,25 +189,25 @@ discard block |
||
| 189 | 189 | elseif (is_search()) : |
| 190 | 190 | ?> |
| 191 | 191 | <header class="archive-header"> |
| 192 | - <h1 class="archive-title"><?php printf( esc_html__( 'Search Results for: %s', 'lsx' ), '<span>' . get_search_query() . '</span>' ); ?></h1> |
|
| 192 | + <h1 class="archive-title"><?php printf(esc_html__('Search Results for: %s', 'lsx'), '<span>' . get_search_query() . '</span>'); ?></h1> |
|
| 193 | 193 | </header> |
| 194 | 194 | <?php |
| 195 | 195 | elseif (is_author()) : |
| 196 | 196 | ?> |
| 197 | 197 | <header class="archive-header"> |
| 198 | 198 | <h1 class="archive-title"> |
| 199 | - <?php printf( esc_html__( 'Author: %s', 'lsx' ), get_the_author() ); ?> |
|
| 199 | + <?php printf(esc_html__('Author: %s', 'lsx'), get_the_author()); ?> |
|
| 200 | 200 | </h1> |
| 201 | 201 | |
| 202 | 202 | <?php if (get_the_author_meta('description')) { ?> |
| 203 | - <p class="author-desc"><?php echo esc_html( get_the_author_meta( 'description' ) ) ?></p> |
|
| 203 | + <p class="author-desc"><?php echo esc_html(get_the_author_meta('description')) ?></p> |
|
| 204 | 204 | <?php } ?> |
| 205 | 205 | </header> |
| 206 | 206 | <?php |
| 207 | - elseif (is_archive() && class_exists('WooCommerce') && is_post_type_archive('product') ) : |
|
| 207 | + elseif (is_archive() && class_exists('WooCommerce') && is_post_type_archive('product')) : |
|
| 208 | 208 | ?> |
| 209 | 209 | <header class="archive-header"> |
| 210 | - <h1 class="archive-title"><?php esc_html_e( 'Shop', 'lsx' ); ?></h1> |
|
| 210 | + <h1 class="archive-title"><?php esc_html_e('Shop', 'lsx'); ?></h1> |
|
| 211 | 211 | <?php echo term_description(); ?> |
| 212 | 212 | </header> |
| 213 | 213 | <?php |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | ?> |
| 216 | 216 | <header class="archive-header"> |
| 217 | 217 | <h1 class="archive-title"> |
| 218 | - <?php if ( has_post_format() && !is_category() && !is_tag() && !is_date() && !is_tax('post_format') ) { ?> |
|
| 218 | + <?php if (has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax('post_format')) { ?> |
|
| 219 | 219 | Type: <?php the_archive_title(); ?> |
| 220 | 220 | <?php } else { ?> |
| 221 | 221 | <?php the_archive_title(); ?> |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | if (in_array('blog', $classes)) { ?> |
| 242 | 242 | <header class="archive-header"> |
| 243 | - <h1 class="archive-title"><?php esc_html_e( 'Blog', 'lsx' ); ?></h1> |
|
| 243 | + <h1 class="archive-title"><?php esc_html_e('Blog', 'lsx'); ?></h1> |
|
| 244 | 244 | </header> |
| 245 | 245 | <?php } |
| 246 | 246 | } |
@@ -253,16 +253,16 @@ discard block |
||
| 253 | 253 | ?> |
| 254 | 254 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> |
| 255 | 255 | <?php } |
| 256 | -add_action( 'wp_head', 'lsx_add_viewport_meta_tag' ); |
|
| 256 | +add_action('wp_head', 'lsx_add_viewport_meta_tag'); |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | 260 | * Add a search form to just above the nav menu |
| 261 | 261 | */ |
| 262 | 262 | function lsx_header_search_form() { |
| 263 | - $search_form = get_theme_mod( 'lsx_header_search', 0 ); |
|
| 264 | - if($search_form || is_customize_preview()){ |
|
| 265 | - get_search_form( true ); |
|
| 263 | + $search_form = get_theme_mod('lsx_header_search', 0); |
|
| 264 | + if ($search_form || is_customize_preview()) { |
|
| 265 | + get_search_form(true); |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | -add_action( 'lsx_nav_before', 'lsx_header_search_form', 0 ); |
|
| 269 | 268 | \ No newline at end of file |
| 269 | +add_action('lsx_nav_before', 'lsx_header_search_form', 0); |
|
| 270 | 270 | \ No newline at end of file |
@@ -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 | * Cleaner walker for wp_nav_menu() |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | $item_html = ''; |
| 26 | 26 | |
| 27 | 27 | //If there is no menu set, dont use the pages, the objects are not the same as whats supposed to be used. |
| 28 | - if(isset($item->title)){ |
|
| 28 | + if (isset($item->title)) { |
|
| 29 | 29 | |
| 30 | 30 | parent::start_el($item_html, $item, $depth, $args); |
| 31 | 31 | |
| 32 | - if ( $item->is_dropdown && ( 0 === $depth ) ) { |
|
| 32 | + if ($item->is_dropdown && (0 === $depth)) { |
|
| 33 | 33 | $item_html = str_replace('<a', '<a class="dropdown-toggle" data-target="#"', $item_html); |
| 34 | 34 | $item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html); |
| 35 | - } elseif ( stristr( $item_html, 'li class="divider"' ) ) { |
|
| 35 | + } elseif (stristr($item_html, 'li class="divider"')) { |
|
| 36 | 36 | $item_html = preg_replace('/<a[^>]*>.*?<\/a>/iU', '', $item_html); |
| 37 | - } elseif ( stristr( $item_html, 'li class="dropdown-header"' ) ) { |
|
| 38 | - $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html ); |
|
| 37 | + } elseif (stristr($item_html, 'li class="dropdown-header"')) { |
|
| 38 | + $item_html = preg_replace('/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $item_html = apply_filters('lsx_wp_nav_menu_item', $item_html); |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) { |
| 48 | - $element->is_dropdown = ( ( ! empty( $children_elements[$element->ID] ) && ( ( $depth + 1 ) < $max_depth || ( 0 === $max_depth ) ) ) ); |
|
| 48 | + $element->is_dropdown = (( ! empty($children_elements[$element->ID]) && (($depth + 1) < $max_depth || (0 === $max_depth)))); |
|
| 49 | 49 | |
| 50 | - if ( $element->is_dropdown ) { |
|
| 51 | - if ( $depth > 0 ) { |
|
| 50 | + if ($element->is_dropdown) { |
|
| 51 | + if ($depth > 0) { |
|
| 52 | 52 | $element->classes[] = 'dropdown-submenu'; |
| 53 | 53 | } else { |
| 54 | 54 | $element->classes[] = 'dropdown'; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $classes = preg_replace('/(current(-menu-|[-_]page[-_])(item|parent|ancestor))/', 'active', $classes); |
| 69 | 69 | $classes = preg_replace('/^((menu|page)[-_\w+]+)+/', '', $classes); |
| 70 | 70 | |
| 71 | - $classes[] = 'menu-'.$slug; |
|
| 71 | + $classes[] = 'menu-' . $slug; |
|
| 72 | 72 | |
| 73 | 73 | $classes = array_unique($classes); |
| 74 | 74 | |
@@ -86,15 +86,15 @@ discard block |
||
| 86 | 86 | function lsx_nav_menu_args($args = '') { |
| 87 | 87 | $roots_nav_menu_args['container'] = false; |
| 88 | 88 | |
| 89 | - if (!$args['items_wrap']) { |
|
| 89 | + if ( ! $args['items_wrap']) { |
|
| 90 | 90 | $roots_nav_menu_args['items_wrap'] = '<ul class="%2$s">%3$s</ul>'; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (current_theme_supports('bootstrap-top-navbar') && !$args['depth']) { |
|
| 93 | + if (current_theme_supports('bootstrap-top-navbar') && ! $args['depth']) { |
|
| 94 | 94 | $roots_nav_menu_args['depth'] = 2; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if (!$args['walker']) { |
|
| 97 | + if ( ! $args['walker']) { |
|
| 98 | 98 | $roots_nav_menu_args['walker'] = new LSX_Nav_Walker(); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -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 | class Lsx_Bootstrap_Navwalker extends Walker_Nav_Menu { |
| 5 | 5 | |
@@ -10,15 +10,15 @@ discard block |
||
| 10 | 10 | * @param string $output Passed by reference. Used to append additional content. |
| 11 | 11 | * @param int $depth Depth of page. Used for padding. |
| 12 | 12 | */ |
| 13 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 14 | - $indent = str_repeat( "\t", $depth ); |
|
| 13 | + public function start_lvl(&$output, $depth = 0, $args = array()) { |
|
| 14 | + $indent = str_repeat("\t", $depth); |
|
| 15 | 15 | $output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n"; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @param string $item Passed by reference. Used to append additional content. |
| 20 | 20 | */ |
| 21 | - public function filter_default_pages( &$item ) { |
|
| 21 | + public function filter_default_pages(&$item) { |
|
| 22 | 22 | |
| 23 | 23 | return $item; |
| 24 | 24 | } |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | * @param int $current_page Menu item ID. |
| 34 | 34 | * @param object $args |
| 35 | 35 | */ |
| 36 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
| 37 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
| 36 | + public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
| 37 | + $indent = ($depth) ? str_repeat("\t", $depth) : ''; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * If this is a default menu being called we need to fix |
| 41 | 41 | * the item object thats coming through. |
| 42 | 42 | */ |
| 43 | - if(!isset($item->title)){ |
|
| 43 | + if ( ! isset($item->title)) { |
|
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -52,62 +52,62 @@ discard block |
||
| 52 | 52 | * comparison that is not case sensitive. The strcasecmp() function returns |
| 53 | 53 | * a 0 if the strings are equal. |
| 54 | 54 | */ |
| 55 | - if ( 0 == strcasecmp( $item->attr_title, 'divider' ) && 1 === $depth ) { |
|
| 55 | + if (0 == strcasecmp($item->attr_title, 'divider') && 1 === $depth) { |
|
| 56 | 56 | $output .= $indent . '<li role="presentation" class="divider">'; |
| 57 | - } elseif ( 0 == strcasecmp( $item->title, 'divider' ) && 1 === $depth ) { |
|
| 57 | + } elseif (0 == strcasecmp($item->title, 'divider') && 1 === $depth) { |
|
| 58 | 58 | $output .= $indent . '<li role="presentation" class="divider">'; |
| 59 | - } elseif ( 0 == strcasecmp( $item->attr_title, 'dropdown-header' ) && 1 === $depth ) { |
|
| 60 | - $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title ); |
|
| 61 | - } elseif ( 0 == strcasecmp( $item->attr_title, 'disabled' ) ) { |
|
| 62 | - $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>'; |
|
| 59 | + } elseif (0 == strcasecmp($item->attr_title, 'dropdown-header') && 1 === $depth) { |
|
| 60 | + $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr($item->title); |
|
| 61 | + } elseif (0 == strcasecmp($item->attr_title, 'disabled')) { |
|
| 62 | + $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr($item->title) . '</a>'; |
|
| 63 | 63 | } else { |
| 64 | 64 | $class_names = $value = ''; |
| 65 | 65 | |
| 66 | - $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
| 66 | + $classes = empty($item->classes) ? array() : (array) $item->classes; |
|
| 67 | 67 | $classes[] = 'menu-item-' . $item->ID; |
| 68 | 68 | |
| 69 | - $classes = apply_filters( 'lsx_nav_menu_css_class', array_filter( $classes ), $item, $args , $depth ); |
|
| 69 | + $classes = apply_filters('lsx_nav_menu_css_class', array_filter($classes), $item, $args, $depth); |
|
| 70 | 70 | |
| 71 | - $class_names = join( ' ', $classes ); |
|
| 71 | + $class_names = join(' ', $classes); |
|
| 72 | 72 | |
| 73 | - if ( $args->has_children ) |
|
| 73 | + if ($args->has_children) |
|
| 74 | 74 | $class_names .= ' dropdown'; |
| 75 | 75 | |
| 76 | - if ( in_array( 'current-menu-item', $classes ) ) |
|
| 76 | + if (in_array('current-menu-item', $classes)) |
|
| 77 | 77 | $class_names .= ' active'; |
| 78 | 78 | |
| 79 | - if ( in_array( 'current-menu-parent', $classes ) ) |
|
| 79 | + if (in_array('current-menu-parent', $classes)) |
|
| 80 | 80 | $class_names .= ' active'; |
| 81 | 81 | |
| 82 | 82 | //Check if this is ment to be a "social" type menu |
| 83 | - $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
|
| 83 | + $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; |
|
| 84 | 84 | |
| 85 | - $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); |
|
| 86 | - $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; |
|
| 85 | + $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); |
|
| 86 | + $id = $id ? ' id="' . esc_attr($id) . '"' : ''; |
|
| 87 | 87 | |
| 88 | - $output .= $indent . '<li' . $id . $value . $class_names .'>'; |
|
| 88 | + $output .= $indent . '<li' . $id . $value . $class_names . '>'; |
|
| 89 | 89 | |
| 90 | 90 | $atts = array(); |
| 91 | - $atts['title'] = ! empty( $item->title ) ? $item->title : ''; |
|
| 92 | - $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
| 93 | - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
| 91 | + $atts['title'] = ! empty($item->title) ? $item->title : ''; |
|
| 92 | + $atts['target'] = ! empty($item->target) ? $item->target : ''; |
|
| 93 | + $atts['rel'] = ! empty($item->xfn) ? $item->xfn : ''; |
|
| 94 | 94 | |
| 95 | 95 | // If item has_children add atts to a. |
| 96 | - if ( $args->has_children ) { |
|
| 97 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 98 | - $atts['data-toggle'] = 'dropdown'; |
|
| 99 | - $atts['class'] = 'dropdown-toggle'; |
|
| 100 | - $atts['aria-haspopup'] = 'true'; |
|
| 96 | + if ($args->has_children) { |
|
| 97 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
| 98 | + $atts['data-toggle'] = 'dropdown'; |
|
| 99 | + $atts['class'] = 'dropdown-toggle'; |
|
| 100 | + $atts['aria-haspopup'] = 'true'; |
|
| 101 | 101 | } else { |
| 102 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 102 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args ); |
|
| 105 | + $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args); |
|
| 106 | 106 | |
| 107 | 107 | $attributes = ''; |
| 108 | - foreach ( $atts as $attr => $value ) { |
|
| 109 | - if ( ! empty( $value ) ) { |
|
| 110 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
| 108 | + foreach ($atts as $attr => $value) { |
|
| 109 | + if ( ! empty($value)) { |
|
| 110 | + $value = ('href' === $attr) ? esc_url($value) : esc_attr($value); |
|
| 111 | 111 | $attributes .= ' ' . $attr . '="' . $value . '"'; |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -121,19 +121,19 @@ discard block |
||
| 121 | 121 | * if there is a value in the attr_title property. If the attr_title |
| 122 | 122 | * property is NOT null we apply it as the class name for the glyphicon. |
| 123 | 123 | */ |
| 124 | - if ( ! empty( $item->attr_title ) ) { |
|
| 125 | - $item_output .= '<a'. $attributes .'"><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span> '; |
|
| 124 | + if ( ! empty($item->attr_title)) { |
|
| 125 | + $item_output .= '<a' . $attributes . '"><span class="glyphicon ' . esc_attr($item->attr_title) . '"></span> '; |
|
| 126 | 126 | } else { |
| 127 | - $item_output .= '<a'. $attributes .'>'; |
|
| 127 | + $item_output .= '<a' . $attributes . '>'; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; |
|
| 131 | - $item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 130 | + $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; |
|
| 131 | + $item_output .= ($args->has_children && 0 === $depth) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 132 | 132 | $item_output .= $args->after; |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | |
| 136 | - $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
| 136 | + $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -157,17 +157,17 @@ discard block |
||
| 157 | 157 | * @param string $output Passed by reference. Used to append additional content. |
| 158 | 158 | * @return null Null on failure with no changes to parameters. |
| 159 | 159 | */ |
| 160 | - public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
|
| 161 | - if ( ! $element ) |
|
| 160 | + public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) { |
|
| 161 | + if ( ! $element) |
|
| 162 | 162 | return; |
| 163 | 163 | |
| 164 | 164 | $id_field = $this->db_fields['id']; |
| 165 | 165 | |
| 166 | 166 | // Display this element. |
| 167 | - if ( is_object( $args[0] ) ) |
|
| 168 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 167 | + if (is_object($args[0])) |
|
| 168 | + $args[0]->has_children = ! empty($children_elements[$element->$id_field]); |
|
| 169 | 169 | |
| 170 | - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
| 170 | + parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -181,17 +181,17 @@ discard block |
||
| 181 | 181 | * @param array $args passed from the wp_nav_menu function. |
| 182 | 182 | * |
| 183 | 183 | */ |
| 184 | - public static function fallback( $args ) { |
|
| 185 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 184 | + public static function fallback($args) { |
|
| 185 | + if (current_user_can('manage_options')) { |
|
| 186 | 186 | $fb_output = null; |
| 187 | 187 | |
| 188 | - if ( $args['container'] ) { |
|
| 188 | + if ($args['container']) { |
|
| 189 | 189 | $fb_output = '<' . $args['container']; |
| 190 | 190 | |
| 191 | - if ( $args['container_id'] ) |
|
| 191 | + if ($args['container_id']) |
|
| 192 | 192 | $fb_output .= ' id="' . $args['container_id'] . '"'; |
| 193 | 193 | |
| 194 | - if ( $args['container_class'] ) |
|
| 194 | + if ($args['container_class']) |
|
| 195 | 195 | $fb_output .= ' class="' . $args['container_class'] . '"'; |
| 196 | 196 | |
| 197 | 197 | $fb_output .= '>'; |
@@ -199,20 +199,20 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $fb_output .= '<ul'; |
| 201 | 201 | |
| 202 | - if ( $args['menu_id'] ) |
|
| 202 | + if ($args['menu_id']) |
|
| 203 | 203 | $fb_output .= ' id="' . $args['menu_id'] . '"'; |
| 204 | 204 | |
| 205 | - if ( $args['menu_class'] ) |
|
| 205 | + if ($args['menu_class']) |
|
| 206 | 206 | $fb_output .= ' class="' . $args['menu_class'] . '"'; |
| 207 | 207 | |
| 208 | 208 | $fb_output .= '>'; |
| 209 | - $fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">' . esc_html__( 'Add a menu', 'lsx' ) . '</a></li>'; |
|
| 209 | + $fb_output .= '<li><a href="' . admin_url('nav-menus.php') . '">' . esc_html__('Add a menu', 'lsx') . '</a></li>'; |
|
| 210 | 210 | $fb_output .= '</ul>'; |
| 211 | 211 | |
| 212 | - if ( $args['container'] ) |
|
| 212 | + if ($args['container']) |
|
| 213 | 213 | $fb_output .= '</' . $args['container'] . '>'; |
| 214 | 214 | |
| 215 | - echo wp_kses_post( $fb_output ); |
|
| 215 | + echo wp_kses_post($fb_output); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -221,9 +221,9 @@ discard block |
||
| 221 | 221 | /** |
| 222 | 222 | * Add in our custom classes to the menus |
| 223 | 223 | */ |
| 224 | -function wpml_nav_language_switcher_fix( $items , $args ) { |
|
| 225 | - $items = str_replace('menu-item-language-current','menu-item-language-current dropdown',$items); |
|
| 226 | - $items = str_replace('submenu-languages','submenu-languages dropdown-menu',$items); |
|
| 224 | +function wpml_nav_language_switcher_fix($items, $args) { |
|
| 225 | + $items = str_replace('menu-item-language-current', 'menu-item-language-current dropdown', $items); |
|
| 226 | + $items = str_replace('submenu-languages', 'submenu-languages dropdown-menu', $items); |
|
| 227 | 227 | return $items; |
| 228 | 228 | } |
| 229 | -add_filter( 'wp_nav_menu_items', 'wpml_nav_language_switcher_fix', 10, 2 ); |
|
| 229 | +add_filter('wp_nav_menu_items', 'wpml_nav_language_switcher_fix', 10, 2); |
|
@@ -9,21 +9,21 @@ |
||
| 9 | 9 | <?php |
| 10 | 10 | $show_on_front = get_option('show_on_front'); |
| 11 | 11 | |
| 12 | - $layout = get_theme_mod('lsx_layout','2cr'); |
|
| 13 | - if('posts' == $show_on_front && is_home()){ |
|
| 12 | + $layout = get_theme_mod('lsx_layout', '2cr'); |
|
| 13 | + if ('posts' == $show_on_front && is_home()) { |
|
| 14 | 14 | $sidebar = 'home'; |
| 15 | - }else{ |
|
| 15 | + } else { |
|
| 16 | 16 | $sidebar = 'sidebar-1'; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - if ( '1c' !== $layout ) : ?> |
|
| 19 | + if ('1c' !== $layout) : ?> |
|
| 20 | 20 | |
| 21 | 21 | <?php lsx_sidebars_before(); ?> |
| 22 | 22 | |
| 23 | 23 | <div id="secondary" class="widget-area <?php echo esc_attr(lsx_sidebar_class()); ?>" role="complementary"> |
| 24 | 24 | |
| 25 | 25 | <?php lsx_sidebar_top(); ?> |
| 26 | - <h2><?php esc_attr_e( 'Categories', 'lsx' ); ?></h2> |
|
| 26 | + <h2><?php esc_attr_e('Categories', 'lsx'); ?></h2> |
|
| 27 | 27 | <aside id="categories" class="widget widget_categories"> |
| 28 | 28 | <?php echo wp_tag_cloud(array('taxonomy'=>'category')); ?> |
| 29 | 29 | </aside> |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | // Allow Plugins and themes to disable the sidebar incase of very customized layouts. |
| 9 | -$sidebar_enabled = apply_filters('lsx_sidebar_enable',true); |
|
| 10 | -if(true !== $sidebar_enabled){return true;} |
|
| 9 | +$sidebar_enabled = apply_filters('lsx_sidebar_enable', true); |
|
| 10 | +if (true !== $sidebar_enabled) {return true; } |
|
| 11 | 11 | ?> |
| 12 | 12 | <?php |
| 13 | 13 | $show_on_front = get_option('show_on_front'); |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | $sidebar = 'home'; |
| 18 | 18 | } else { |
| 19 | 19 | |
| 20 | - $layout = get_theme_mod('lsx_layout','2cr'); |
|
| 21 | - $layout = apply_filters( 'lsx_layout', $layout ); |
|
| 20 | + $layout = get_theme_mod('lsx_layout', '2cr'); |
|
| 21 | + $layout = apply_filters('lsx_layout', $layout); |
|
| 22 | 22 | |
| 23 | - if('posts' == $show_on_front && is_home()){ |
|
| 23 | + if ('posts' == $show_on_front && is_home()) { |
|
| 24 | 24 | $sidebar = 'home'; |
| 25 | - }else{ |
|
| 25 | + } else { |
|
| 26 | 26 | $sidebar = 'sidebar-1'; |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - if ( '1c' !== $layout ) : ?> |
|
| 29 | + if ('1c' !== $layout) : ?> |
|
| 30 | 30 | |
| 31 | 31 | <?php lsx_sidebars_before(); ?> |
| 32 | 32 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | <div id="secondary" class="widget-area <?php echo esc_attr(lsx_home_sidebar_class()); ?>" role="complementary"> |
| 36 | 36 | |
| 37 | - <?php elseif ( is_page_template('page-templates/template-blog.php') ) : ?> |
|
| 37 | + <?php elseif (is_page_template('page-templates/template-blog.php')) : ?> |
|
| 38 | 38 | |
| 39 | 39 | <div id="secondary" class="widget-area <?php echo esc_attr(lsx_sidebar_class()); ?>" role="complementary"> |
| 40 | 40 | |
@@ -42,25 +42,25 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | <div id="secondary" class="widget-area <?php echo esc_attr(lsx_sidebar_class()); ?>" role="complementary"> |
| 44 | 44 | |
| 45 | - <?php endif ; ?> |
|
| 45 | + <?php endif; ?> |
|
| 46 | 46 | |
| 47 | 47 | <?php lsx_sidebar_top(); ?> |
| 48 | 48 | |
| 49 | - <?php if ( ! dynamic_sidebar( $sidebar ) ) : ?> |
|
| 49 | + <?php if ( ! dynamic_sidebar($sidebar)) : ?> |
|
| 50 | 50 | |
| 51 | 51 | <aside id="search" class="widget widget_search"> |
| 52 | 52 | <?php get_search_form(); ?> |
| 53 | 53 | </aside> |
| 54 | 54 | |
| 55 | 55 | <aside id="archives" class="widget"> |
| 56 | - <h1 class="widget-title"><?php esc_attr_e( 'Archives', 'lsx' ); ?></h1> |
|
| 56 | + <h1 class="widget-title"><?php esc_attr_e('Archives', 'lsx'); ?></h1> |
|
| 57 | 57 | <ul> |
| 58 | - <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?> |
|
| 58 | + <?php wp_get_archives(array('type' => 'monthly')); ?> |
|
| 59 | 59 | </ul> |
| 60 | 60 | </aside> |
| 61 | 61 | |
| 62 | 62 | <aside id="meta" class="widget"> |
| 63 | - <h1 class="widget-title"><?php esc_attr_e( 'Meta', 'lsx' ); ?></h1> |
|
| 63 | + <h1 class="widget-title"><?php esc_attr_e('Meta', 'lsx'); ?></h1> |
|
| 64 | 64 | <ul> |
| 65 | 65 | <?php wp_register(); ?> |
| 66 | 66 | <li><?php wp_loginout(); ?></li> |
@@ -1,24 +1,24 @@ |
||
| 1 | 1 | <?php |
| 2 | - if ( isset( $GLOBALS['comment_depth'] ) ) { |
|
| 3 | - $depth = intval( $GLOBALS['comment_depth'] ); |
|
| 2 | + if (isset($GLOBALS['comment_depth'])) { |
|
| 3 | + $depth = intval($GLOBALS['comment_depth']); |
|
| 4 | 4 | } else { |
| 5 | 5 | $depth = 1; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | - $max_depth = intval( get_option( 'thread_comments_depth' ) ); |
|
| 8 | + $max_depth = intval(get_option('thread_comments_depth')); |
|
| 9 | 9 | ?> |
| 10 | 10 | |
| 11 | 11 | <?php echo get_avatar($comment, '64'); ?> |
| 12 | 12 | <div class="media-body"> |
| 13 | 13 | <h4 class="media-heading"><?php echo get_comment_author_link(); ?></h4> |
| 14 | - <time datetime="<?php echo comment_date('c'); ?>"><a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?>"><?php printf(esc_html__('%1$s on %2$s', 'lsx'), get_comment_date(), get_comment_time()); ?></a></time> |
|
| 14 | + <time datetime="<?php echo comment_date('c'); ?>"><a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?>"><?php printf(esc_html__('%1$s on %2$s', 'lsx'), get_comment_date(), get_comment_time()); ?></a></time> |
|
| 15 | 15 | <?php edit_comment_link(esc_html__('(Edit)', 'lsx'), '', ''); ?> |
| 16 | 16 | |
| 17 | - <?php if ( '0' == $comment->comment_approved ) : ?> |
|
| 17 | + <?php if ('0' == $comment->comment_approved) : ?> |
|
| 18 | 18 | <div class="alert alert-info"> |
| 19 | 19 | <?php esc_html_e('Your comment is awaiting moderation.', 'lsx'); ?> |
| 20 | 20 | </div> |
| 21 | 21 | <?php endif; ?> |
| 22 | 22 | |
| 23 | 23 | <?php comment_text(); ?> |
| 24 | -<?php comment_reply_link( array( 'depth' => $depth, 'max_depth' => $max_depth ) ); |
|
| 25 | 24 | \ No newline at end of file |
| 25 | +<?php comment_reply_link(array('depth' => $depth, 'max_depth' => $max_depth)); |
|
| 26 | 26 | \ No newline at end of file |