@@ -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 | * Yoast Breadcrumbs on Twitter Bootstrap |
@@ -10,21 +10,21 @@ discard block |
||
| 10 | 10 | * @param string $sep Your custom separator |
| 11 | 11 | */ |
| 12 | 12 | function lsx_breadcrumbs() { |
| 13 | - if (!function_exists('yoast_breadcrumb') && !function_exists('woocommerce_breadcrumb')) { |
|
| 13 | + if ( ! function_exists('yoast_breadcrumb') && ! function_exists('woocommerce_breadcrumb')) { |
|
| 14 | 14 | return null; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | $show_on_front = get_option('show_on_front'); |
| 18 | - if ( ('posts' == $show_on_front && is_home()) || ('page' == $show_on_front && is_front_page()) ) { |
|
| 18 | + if (('posts' == $show_on_front && is_home()) || ('page' == $show_on_front && is_front_page())) { |
|
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if(function_exists('woocommerce_breadcrumb')){ |
|
| 22 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 23 | 23 | ob_start(); |
| 24 | 24 | woocommerce_breadcrumb(); |
| 25 | 25 | $output = ob_get_clean(); |
| 26 | 26 | $output = str_replace('woocommerce-breadcrumb', 'woocommerce-breadcrumb breadcrumbs-container', $output); |
| 27 | - }elseif(function_exists('yoast_breadcrumb')){ |
|
| 27 | + }elseif (function_exists('yoast_breadcrumb')) { |
|
| 28 | 28 | // Default Yoast Breadcrumbs Separator |
| 29 | 29 | $old_sep = '\»\;'; |
| 30 | 30 | |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | $output = '<div class="breadcrumbs-container">' . $output . '</div>'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $output = apply_filters('lsx_breadcrumbs',$output); |
|
| 45 | + $output = apply_filters('lsx_breadcrumbs', $output); |
|
| 46 | 46 | |
| 47 | 47 | echo $output; |
| 48 | 48 | } |
| 49 | -add_action( 'lsx_content_top', 'lsx_breadcrumbs', 100 ); |
|
| 49 | +add_action('lsx_content_top', 'lsx_breadcrumbs', 100); |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Replaces the seperator with a blank space. |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | function lsx_breadcrumbs_seperator_filter($seperator) { |
| 56 | 56 | return ''; |
| 57 | 57 | } |
| 58 | -add_filter( 'wpseo_breadcrumb_separator', 'lsx_breadcrumbs_seperator_filter' ); |
|
| 58 | +add_filter('wpseo_breadcrumb_separator', 'lsx_breadcrumbs_seperator_filter'); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Custom template tags for this theme. |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @package lsx |
| 65 | 65 | */ |
| 66 | -if ( ! function_exists( 'lsx_site_title' ) ) : |
|
| 66 | +if ( ! function_exists('lsx_site_title')) : |
|
| 67 | 67 | /** |
| 68 | 68 | * Displays logo when applicable |
| 69 | 69 | * |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | function lsx_site_title() { |
| 73 | 73 | ?> |
| 74 | 74 | <div class="site-branding"> |
| 75 | - <h1 class="site-title"><a title="<?php bloginfo( 'name' ); ?>" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> |
|
| 76 | - <p class="site-description"><?php bloginfo( 'description' ); ?></p> |
|
| 75 | + <h1 class="site-title"><a title="<?php bloginfo('name'); ?>" href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a></h1> |
|
| 76 | + <p class="site-description"><?php bloginfo('description'); ?></p> |
|
| 77 | 77 | </div> |
| 78 | 78 | <?php |
| 79 | 79 | } |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * Add customisable post meta. |
| 84 | 84 | */ |
| 85 | -if ( ! function_exists( 'lsx_post_meta' ) ) { |
|
| 85 | +if ( ! function_exists('lsx_post_meta')) { |
|
| 86 | 86 | function lsx_post_meta() { |
| 87 | - if ( ( is_page() && ! ( is_home() || is_front_page() ) ) && ! is_page_template( 'page-templates/template-blog.php' ) ) { |
|
| 87 | + if ((is_page() && ! (is_home() || is_front_page())) && ! is_page_template('page-templates/template-blog.php')) { |
|
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | ?> |
@@ -99,83 +99,83 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Add customisable post meta: post date |
| 101 | 101 | */ |
| 102 | -if ( ! function_exists( 'lsx_post_meta_date' ) ) { |
|
| 102 | +if ( ! function_exists('lsx_post_meta_date')) { |
|
| 103 | 103 | function lsx_post_meta_date() { |
| 104 | 104 | $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; |
| 105 | 105 | |
| 106 | - $time_string = sprintf( $time_string, |
|
| 107 | - esc_attr( get_the_date( 'c' ) ), |
|
| 106 | + $time_string = sprintf($time_string, |
|
| 107 | + esc_attr(get_the_date('c')), |
|
| 108 | 108 | get_the_date(), |
| 109 | - esc_attr( get_the_modified_date( 'c' ) ), |
|
| 109 | + esc_attr(get_the_modified_date('c')), |
|
| 110 | 110 | get_the_modified_date() |
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | - printf( '<span class="post-meta-time"><span>%1$s</span> <a href="%2$s" rel="bookmark">%3$s</a></span>', |
|
| 114 | - _x( 'Posted on:', 'Used before publish date.', 'lsx' ), |
|
| 115 | - esc_url( get_permalink() ), |
|
| 113 | + printf('<span class="post-meta-time"><span>%1$s</span> <a href="%2$s" rel="bookmark">%3$s</a></span>', |
|
| 114 | + _x('Posted on:', 'Used before publish date.', 'lsx'), |
|
| 115 | + esc_url(get_permalink()), |
|
| 116 | 116 | $time_string |
| 117 | 117 | ); |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | -add_action( 'lsx_content_post_meta', 'lsx_post_meta_date', 10 ); |
|
| 120 | +add_action('lsx_content_post_meta', 'lsx_post_meta_date', 10); |
|
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | 123 | * Add customisable post meta: post author |
| 124 | 124 | */ |
| 125 | -if ( ! function_exists( 'lsx_post_meta_author' ) ) { |
|
| 125 | +if ( ! function_exists('lsx_post_meta_author')) { |
|
| 126 | 126 | function lsx_post_meta_author() { |
| 127 | - printf( '<span class="post-meta-author"><span>%1$s</span> <a href="%2$s">%3$s</a></span>', |
|
| 128 | - _x( 'Posted by:', 'Used before post author name.', 'lsx' ), |
|
| 129 | - esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), |
|
| 127 | + printf('<span class="post-meta-author"><span>%1$s</span> <a href="%2$s">%3$s</a></span>', |
|
| 128 | + _x('Posted by:', 'Used before post author name.', 'lsx'), |
|
| 129 | + esc_url(get_author_posts_url(get_the_author_meta('ID'))), |
|
| 130 | 130 | get_the_author() |
| 131 | 131 | ); |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | -add_action( 'lsx_content_post_meta', 'lsx_post_meta_author', 20 ); |
|
| 134 | +add_action('lsx_content_post_meta', 'lsx_post_meta_author', 20); |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Add customisable post meta: post category(ies) |
| 138 | 138 | */ |
| 139 | -if ( ! function_exists( 'lsx_post_meta_category' ) ) { |
|
| 139 | +if ( ! function_exists('lsx_post_meta_category')) { |
|
| 140 | 140 | function lsx_post_meta_category() { |
| 141 | - $post_categories = wp_get_post_categories( get_the_ID() ); |
|
| 141 | + $post_categories = wp_get_post_categories(get_the_ID()); |
|
| 142 | 142 | $cats = array(); |
| 143 | 143 | |
| 144 | - foreach( $post_categories as $c ) { |
|
| 145 | - $cat = get_category( $c ); |
|
| 146 | - $cats[] = '<a href="' . get_category_link( $cat->term_id ) . '" title="' . sprintf( esc_html__( 'View all posts in %s' , 'lsx' ), $cat->name ) . '" ' . '>' . $cat->name . '</a>'; |
|
| 144 | + foreach ($post_categories as $c) { |
|
| 145 | + $cat = get_category($c); |
|
| 146 | + $cats[] = '<a href="' . get_category_link($cat->term_id) . '" title="' . sprintf(esc_html__('View all posts in %s', 'lsx'), $cat->name) . '" ' . '>' . $cat->name . '</a>'; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if ( ! empty( $cats ) ) { |
|
| 149 | + if ( ! empty($cats)) { |
|
| 150 | 150 | ?> |
| 151 | - <span class="post-meta-categories"><span><?php esc_html_e( 'Posted in:', 'lsx' ); ?></span> <?php echo implode( ', ', $cats ); ?></span> |
|
| 151 | + <span class="post-meta-categories"><span><?php esc_html_e('Posted in:', 'lsx'); ?></span> <?php echo implode(', ', $cats); ?></span> |
|
| 152 | 152 | <?php |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | -add_action( 'lsx_content_post_meta', 'lsx_post_meta_category', 30 ); |
|
| 156 | +add_action('lsx_content_post_meta', 'lsx_post_meta_category', 30); |
|
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * Add customisable post meta: post tag(s) |
| 160 | 160 | */ |
| 161 | -if ( ! function_exists( 'lsx_post_tags' ) ) { |
|
| 161 | +if ( ! function_exists('lsx_post_tags')) { |
|
| 162 | 162 | function lsx_post_tags() { |
| 163 | - if ( has_tag() ) : |
|
| 163 | + if (has_tag()) : |
|
| 164 | 164 | ?> |
| 165 | 165 | <div class="post-tags"> |
| 166 | - <span><?php esc_html_e( 'Tagged as:', 'lsx' ); ?></span> <?php echo wp_kses_post( get_the_tag_list( '' ) ); ?> |
|
| 166 | + <span><?php esc_html_e('Tagged as:', 'lsx'); ?></span> <?php echo wp_kses_post(get_the_tag_list('')); ?> |
|
| 167 | 167 | </div> |
| 168 | 168 | <?php |
| 169 | 169 | endif; |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | -add_action( 'lsx_content_post_tags', 'lsx_post_tags', 10 ); |
|
| 172 | +add_action('lsx_content_post_tags', 'lsx_post_tags', 10); |
|
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * Add customisable post info: related posts |
| 176 | 176 | */ |
| 177 | 177 | function lsx_related_posts() { |
| 178 | - if ( is_singular( 'post' ) && class_exists( 'Jetpack_RelatedPosts' ) ) { |
|
| 178 | + if (is_singular('post') && class_exists('Jetpack_RelatedPosts')) { |
|
| 179 | 179 | ?> |
| 180 | 180 | <div class="row row-related-posts"> |
| 181 | 181 | <div class="col-md-12"> |
@@ -185,15 +185,15 @@ discard block |
||
| 185 | 185 | <?php |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | -add_action( 'lsx_entry_bottom', 'lsx_related_posts', 10 ); |
|
| 188 | +add_action('lsx_entry_bottom', 'lsx_related_posts', 10); |
|
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | 191 | * Translate post format to Font Awesome class |
| 192 | 192 | */ |
| 193 | 193 | |
| 194 | -if ( ! function_exists( 'lsx_translate_format_to_fontawesome' ) ) { |
|
| 195 | - function lsx_translate_format_to_fontawesome( $format ) { |
|
| 196 | - switch ( $format ) { |
|
| 194 | +if ( ! function_exists('lsx_translate_format_to_fontawesome')) { |
|
| 195 | + function lsx_translate_format_to_fontawesome($format) { |
|
| 196 | + switch ($format) { |
|
| 197 | 197 | case 'image': |
| 198 | 198 | $format = 'camera'; |
| 199 | 199 | break; |
@@ -238,44 +238,44 @@ discard block |
||
| 238 | 238 | * to be added/modified where necessary. |
| 239 | 239 | */ |
| 240 | 240 | |
| 241 | -if ( ! function_exists( 'lsx_portfolio_meta' ) ) { |
|
| 241 | +if ( ! function_exists('lsx_portfolio_meta')) { |
|
| 242 | 242 | function lsx_portfolio_meta() { |
| 243 | 243 | ?> |
| 244 | 244 | <div id="portfolio-meta" class="portfolio-meta info-box-sticky info-box sticky-wrapper"> |
| 245 | 245 | <?php |
| 246 | - $client = get_post_meta(get_the_ID(),'lsx-client',true); |
|
| 247 | - if(false != $client){ ?> |
|
| 246 | + $client = get_post_meta(get_the_ID(), 'lsx-client', true); |
|
| 247 | + if (false != $client) { ?> |
|
| 248 | 248 | <div class="portfolio-client"> |
| 249 | - <span><span class="fa fa-user"></span><?php _e('Client','lsx'); ?></span> |
|
| 249 | + <span><span class="fa fa-user"></span><?php _e('Client', 'lsx'); ?></span> |
|
| 250 | 250 | <span><?php echo $client ?></span> |
| 251 | 251 | </div> |
| 252 | 252 | <?php } ?> |
| 253 | 253 | |
| 254 | 254 | <?php |
| 255 | - $portfolio_type = get_the_term_list( get_the_ID(), 'jetpack-portfolio-type', '', ', ', '' ); |
|
| 255 | + $portfolio_type = get_the_term_list(get_the_ID(), 'jetpack-portfolio-type', '', ', ', ''); |
|
| 256 | 256 | |
| 257 | - if($portfolio_type){ |
|
| 257 | + if ($portfolio_type) { |
|
| 258 | 258 | ?> |
| 259 | 259 | <div class="portfolio-industry"> |
| 260 | - <span><span class="fa fa-folder-open"></span><?php _e('Industry','lsx'); ?></span> |
|
| 260 | + <span><span class="fa fa-folder-open"></span><?php _e('Industry', 'lsx'); ?></span> |
|
| 261 | 261 | <?php echo $portfolio_type; ?> |
| 262 | 262 | </div> |
| 263 | 263 | <?php } ?> |
| 264 | 264 | |
| 265 | 265 | <?php |
| 266 | - $services = get_the_term_list( get_the_ID(), 'jetpack-portfolio-tag', '', ', ', '' ); |
|
| 267 | - if(false != $services){ ?> |
|
| 266 | + $services = get_the_term_list(get_the_ID(), 'jetpack-portfolio-tag', '', ', ', ''); |
|
| 267 | + if (false != $services) { ?> |
|
| 268 | 268 | <div class="portfolio-services"> |
| 269 | - <span><span class="fa fa-cog"></span><?php _e('Services','lsx'); ?></span> |
|
| 269 | + <span><span class="fa fa-cog"></span><?php _e('Services', 'lsx'); ?></span> |
|
| 270 | 270 | <?php echo $services ?> |
| 271 | 271 | </div> |
| 272 | 272 | <?php } ?> |
| 273 | 273 | |
| 274 | 274 | <?php |
| 275 | - $website = esc_url( get_post_meta(get_the_ID(),'lsx-website',true) ); |
|
| 276 | - if(false != $website){ ?> |
|
| 275 | + $website = esc_url(get_post_meta(get_the_ID(), 'lsx-website', true)); |
|
| 276 | + if (false != $website) { ?> |
|
| 277 | 277 | <div class="portfolio-website"> |
| 278 | - <span><span class="fa fa-link"></span><?php _e('Website','lsx'); ?></span> |
|
| 278 | + <span><span class="fa fa-link"></span><?php _e('Website', 'lsx'); ?></span> |
|
| 279 | 279 | <a target="_blank" href="<?php echo esc_url($website); ?>"><?php echo $website ?></a> |
| 280 | 280 | </div> |
| 281 | 281 | <?php } ?> |
@@ -290,29 +290,29 @@ discard block |
||
| 290 | 290 | * |
| 291 | 291 | */ |
| 292 | 292 | |
| 293 | -if ( ! function_exists( 'lsx_portfolio_gallery' ) ) { |
|
| 293 | +if ( ! function_exists('lsx_portfolio_gallery')) { |
|
| 294 | 294 | function lsx_portfolio_gallery() { |
| 295 | 295 | |
| 296 | - $media = get_attached_media( 'image' ); |
|
| 296 | + $media = get_attached_media('image'); |
|
| 297 | 297 | $media_array = array(); |
| 298 | 298 | $post_thumbnail_id = get_post_thumbnail_id(get_the_ID()); |
| 299 | 299 | |
| 300 | - if(!empty($media)){ |
|
| 301 | - foreach($media as $media_item){ |
|
| 302 | - if($post_thumbnail_id != $media_item->ID) { |
|
| 300 | + if ( ! empty($media)) { |
|
| 301 | + foreach ($media as $media_item) { |
|
| 302 | + if ($post_thumbnail_id != $media_item->ID) { |
|
| 303 | 303 | $media_array[] = $media_item->ID; |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if(!empty($media_array)){ |
|
| 308 | - echo gallery_shortcode(array('size'=>'full','ids'=>implode(',', $media_array))); |
|
| 307 | + if ( ! empty($media_array)) { |
|
| 308 | + echo gallery_shortcode(array('size'=>'full', 'ids'=>implode(',', $media_array))); |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | -if ( ! function_exists( 'lsx_paging_nav' ) ) : |
|
| 315 | +if ( ! function_exists('lsx_paging_nav')) : |
|
| 316 | 316 | /** |
| 317 | 317 | * Display navigation to next/previous set of posts when applicable. |
| 318 | 318 | * |
@@ -320,22 +320,22 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | function lsx_paging_nav() { |
| 322 | 322 | // Don't print empty markup if there's only one page. |
| 323 | - if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { |
|
| 323 | + if ($GLOBALS['wp_query']->max_num_pages < 2) { |
|
| 324 | 324 | return; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - if(current_theme_supports('infinite-scroll') && class_exists('The_Neverending_Home_Page')){ |
|
| 327 | + if (current_theme_supports('infinite-scroll') && class_exists('The_Neverending_Home_Page')) { |
|
| 328 | 328 | return true; |
| 329 | - }elseif(function_exists('wp_pagenavi')){ |
|
| 329 | + }elseif (function_exists('wp_pagenavi')) { |
|
| 330 | 330 | wp_pagenavi(); |
| 331 | - }else{ |
|
| 331 | + } else { |
|
| 332 | 332 | |
| 333 | 333 | $labels = array( |
| 334 | - 'next' => '<span class="meta-nav">←</span> '.__( 'Older posts', 'lsx' ), |
|
| 335 | - 'previous' => __( 'Newer posts', 'lsx' ).' <span class="meta-nav">→</span>', |
|
| 336 | - 'title' => __( 'Posts navigation', 'lsx' ) |
|
| 334 | + 'next' => '<span class="meta-nav">←</span> ' . __('Older posts', 'lsx'), |
|
| 335 | + 'previous' => __('Newer posts', 'lsx') . ' <span class="meta-nav">→</span>', |
|
| 336 | + 'title' => __('Posts navigation', 'lsx') |
|
| 337 | 337 | ); |
| 338 | - $labels = apply_filters('lsx_post_navigation_labels',$labels); |
|
| 338 | + $labels = apply_filters('lsx_post_navigation_labels', $labels); |
|
| 339 | 339 | |
| 340 | 340 | extract($labels); |
| 341 | 341 | ?> |
@@ -343,12 +343,12 @@ discard block |
||
| 343 | 343 | <div class="lsx-breaker"></div> |
| 344 | 344 | <h1 class="screen-reader-text"><?php echo $title; ?></h1> |
| 345 | 345 | <div class="nav-links"> |
| 346 | - <?php if ( get_next_posts_link() ) : ?> |
|
| 347 | - <div class="nav-previous"><?php next_posts_link( $next ); ?></div> |
|
| 346 | + <?php if (get_next_posts_link()) : ?> |
|
| 347 | + <div class="nav-previous"><?php next_posts_link($next); ?></div> |
|
| 348 | 348 | <?php endif; ?> |
| 349 | 349 | |
| 350 | - <?php if ( get_previous_posts_link() ) : ?> |
|
| 351 | - <div class="nav-next"><?php previous_posts_link( $previous ); ?></div> |
|
| 350 | + <?php if (get_previous_posts_link()) : ?> |
|
| 351 | + <div class="nav-next"><?php previous_posts_link($previous); ?></div> |
|
| 352 | 352 | <?php endif; ?> |
| 353 | 353 | |
| 354 | 354 | <div class="clearfix"></div> |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | endif; |
| 361 | 361 | |
| 362 | -if ( ! function_exists( 'lsx_post_nav' ) ) : |
|
| 362 | +if ( ! function_exists('lsx_post_nav')) : |
|
| 363 | 363 | /** |
| 364 | 364 | * Display navigation to next/previous post when applicable. |
| 365 | 365 | * |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | function lsx_post_nav() { |
| 369 | 369 | // Don't print empty markup if there's nowhere to navigate. |
| 370 | - $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); |
|
| 371 | - $next = get_adjacent_post( false, '', false ); |
|
| 370 | + $previous = (is_attachment()) ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); |
|
| 371 | + $next = get_adjacent_post(false, '', false); |
|
| 372 | 372 | |
| 373 | - if ( ! $next && ! $previous ) { |
|
| 373 | + if ( ! $next && ! $previous) { |
|
| 374 | 374 | return; |
| 375 | 375 | } |
| 376 | 376 | ?> |
@@ -380,13 +380,13 @@ discard block |
||
| 380 | 380 | <div class="nav-links pager row"> |
| 381 | 381 | |
| 382 | 382 | <?php |
| 383 | - $previous_post = get_previous_post_link( '%link', '<div class="previous col-md-6"><p class="nav-links-description">'._x( 'Previous Post', 'Previous post link', 'lsx' ).'</p><h3>%title</h3></div>' ); |
|
| 384 | - $previous_post = str_replace('<a','<a',$previous_post); |
|
| 383 | + $previous_post = get_previous_post_link('%link', '<div class="previous col-md-6"><p class="nav-links-description">' . _x('Previous Post', 'Previous post link', 'lsx') . '</p><h3>%title</h3></div>'); |
|
| 384 | + $previous_post = str_replace('<a', '<a', $previous_post); |
|
| 385 | 385 | echo $previous_post; |
| 386 | 386 | ?> |
| 387 | 387 | <?php |
| 388 | - $next_post = get_next_post_link( '%link', '<div class="next col-md-6"><p class="nav-links-description">'._x( 'Next Post', 'Next post link', 'lsx' ).'</p><h3>%title</h3></div>' ); |
|
| 389 | - $next_post = str_replace('<a','<a',$next_post); |
|
| 388 | + $next_post = get_next_post_link('%link', '<div class="next col-md-6"><p class="nav-links-description">' . _x('Next Post', 'Next post link', 'lsx') . '</p><h3>%title</h3></div>'); |
|
| 389 | + $next_post = str_replace('<a', '<a', $next_post); |
|
| 390 | 390 | echo $next_post; |
| 391 | 391 | ?> |
| 392 | 392 | |
@@ -403,16 +403,16 @@ discard block |
||
| 403 | 403 | * @subpackage template-tags |
| 404 | 404 | * @category header |
| 405 | 405 | */ |
| 406 | -if(!function_exists('lsx_site_identity')){ |
|
| 407 | - function lsx_site_identity(){ |
|
| 406 | +if ( ! function_exists('lsx_site_identity')) { |
|
| 407 | + function lsx_site_identity() { |
|
| 408 | 408 | |
| 409 | - if ( function_exists('has_custom_logo') && has_custom_logo() ) { |
|
| 409 | + if (function_exists('has_custom_logo') && has_custom_logo()) { |
|
| 410 | 410 | the_custom_logo(); |
| 411 | - }elseif ( function_exists( 'jetpack_has_site_logo' ) && jetpack_has_site_logo() ) { |
|
| 411 | + }elseif (function_exists('jetpack_has_site_logo') && jetpack_has_site_logo()) { |
|
| 412 | 412 | jetpack_the_site_logo(); |
| 413 | - }else{ |
|
| 413 | + } else { |
|
| 414 | 414 | // shouldn't show both together.. its just strange |
| 415 | - if(true == get_theme_mod('site_logo_header_text',1)){ |
|
| 415 | + if (true == get_theme_mod('site_logo_header_text', 1)) { |
|
| 416 | 416 | lsx_site_title(); |
| 417 | 417 | } |
| 418 | 418 | } |
@@ -427,17 +427,17 @@ discard block |
||
| 427 | 427 | * @subpackage template-tags |
| 428 | 428 | * @category navigation |
| 429 | 429 | */ |
| 430 | -if(!function_exists('lsx_navbar_header')){ |
|
| 431 | - function lsx_navbar_header(){ ?> |
|
| 430 | +if ( ! function_exists('lsx_navbar_header')) { |
|
| 431 | + function lsx_navbar_header() { ?> |
|
| 432 | 432 | <div class="navbar-header" itemscope itemtype="http://schema.org/WebPage"> |
| 433 | 433 | |
| 434 | 434 | <?php |
| 435 | - $nav_menu = get_theme_mod('nav_menu_locations',false); |
|
| 435 | + $nav_menu = get_theme_mod('nav_menu_locations', false); |
|
| 436 | 436 | //print_r(get_nav_menu_locations()); |
| 437 | 437 | |
| 438 | - if(false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']){ ?> |
|
| 438 | + if (false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']) { ?> |
|
| 439 | 439 | <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".primary-navbar"> |
| 440 | - <span class="sr-only"><?php _e('Toggle navigation','lsx'); ?></span> |
|
| 440 | + <span class="sr-only"><?php _e('Toggle navigation', 'lsx'); ?></span> |
|
| 441 | 441 | <span class="icon-bar"></span> |
| 442 | 442 | <span class="icon-bar"></span> |
| 443 | 443 | <span class="icon-bar"></span> |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | <?php } |
| 450 | 450 | } |
| 451 | 451 | //the if statement is for backwards compatability with previous versions of the theme. |
| 452 | -add_action('lsx_nav_before','lsx_navbar_header'); |
|
| 452 | +add_action('lsx_nav_before', 'lsx_navbar_header'); |
|
| 453 | 453 | |
| 454 | 454 | /** |
| 455 | 455 | * Outputs the Nav Menu |
@@ -458,16 +458,16 @@ discard block |
||
| 458 | 458 | * @subpackage template-tags |
| 459 | 459 | * @category navigation |
| 460 | 460 | */ |
| 461 | -if(!function_exists('lsx_nav_menu')){ |
|
| 462 | - function lsx_nav_menu(){ |
|
| 463 | - $nav_menu = get_theme_mod('nav_menu_locations',false); |
|
| 461 | +if ( ! function_exists('lsx_nav_menu')) { |
|
| 462 | + function lsx_nav_menu() { |
|
| 463 | + $nav_menu = get_theme_mod('nav_menu_locations', false); |
|
| 464 | 464 | |
| 465 | 465 | //print_r(get_nav_menu_locations()); |
| 466 | 466 | |
| 467 | - if(false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']){ ?> |
|
| 467 | + if (false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']) { ?> |
|
| 468 | 468 | <nav class="primary-navbar collapse navbar-collapse"> |
| 469 | 469 | <?php |
| 470 | - wp_nav_menu( array( |
|
| 470 | + wp_nav_menu(array( |
|
| 471 | 471 | 'theme_location' => 'primary', |
| 472 | 472 | 'menu' => $nav_menu['primary'], |
| 473 | 473 | 'depth' => 3, |
@@ -477,9 +477,9 @@ discard block |
||
| 477 | 477 | ); |
| 478 | 478 | ?> |
| 479 | 479 | </nav> |
| 480 | - <?php } elseif(is_customize_preview()) { ?> |
|
| 480 | + <?php } elseif (is_customize_preview()) { ?> |
|
| 481 | 481 | <nav class="primary-navbar collapse navbar-collapse"> |
| 482 | - <div class="alert alert-info" role="alert"><?php _e('Create a menu and assign it here via the "Navigation" panel.','lsx');?></div> |
|
| 482 | + <div class="alert alert-info" role="alert"><?php _e('Create a menu and assign it here via the "Navigation" panel.', 'lsx'); ?></div> |
|
| 483 | 483 | </nav> |
| 484 | 484 | </div> |
| 485 | 485 | <?php } |
@@ -493,9 +493,9 @@ discard block |
||
| 493 | 493 | * @subpackage template-tags |
| 494 | 494 | * @category sitemap |
| 495 | 495 | */ |
| 496 | -function lsx_sitemap_pages(){ |
|
| 496 | +function lsx_sitemap_pages() { |
|
| 497 | 497 | $posts_per_page = get_option('posts_per_page'); |
| 498 | - if(false == $posts_per_page){ |
|
| 498 | + if (false == $posts_per_page) { |
|
| 499 | 499 | $posts_per_page = 10; |
| 500 | 500 | } |
| 501 | 501 | |
@@ -506,13 +506,13 @@ discard block |
||
| 506 | 506 | 'post_type' => 'page', |
| 507 | 507 | ); |
| 508 | 508 | $pages = new WP_Query($page_args); |
| 509 | - if($pages->have_posts()){ |
|
| 509 | + if ($pages->have_posts()) { |
|
| 510 | 510 | |
| 511 | - echo '<h2>'.__( 'Pages', 'lsx' ).'</h2>'; |
|
| 511 | + echo '<h2>' . __('Pages', 'lsx') . '</h2>'; |
|
| 512 | 512 | |
| 513 | 513 | echo '<ul>'; |
| 514 | - while($pages->have_posts()){ $pages->the_post(); |
|
| 515 | - echo '<li class="page_item page-item-'.get_the_ID().'"><a href="'.get_permalink().'" title="">'.get_the_title().'</a></li>'; |
|
| 514 | + while ($pages->have_posts()) { $pages->the_post(); |
|
| 515 | + echo '<li class="page_item page-item-' . get_the_ID() . '"><a href="' . get_permalink() . '" title="">' . get_the_title() . '</a></li>'; |
|
| 516 | 516 | } |
| 517 | 517 | echo '</ul>'; |
| 518 | 518 | |
@@ -527,10 +527,10 @@ discard block |
||
| 527 | 527 | * @subpackage template-tags |
| 528 | 528 | * @category sitemap |
| 529 | 529 | */ |
| 530 | -function lsx_sitemap_custom_post_type(){ |
|
| 530 | +function lsx_sitemap_custom_post_type() { |
|
| 531 | 531 | |
| 532 | 532 | $posts_per_page = get_option('posts_per_page'); |
| 533 | - if(false == $posts_per_page){ |
|
| 533 | + if (false == $posts_per_page) { |
|
| 534 | 534 | $posts_per_page = 10; |
| 535 | 535 | } |
| 536 | 536 | |
@@ -538,8 +538,8 @@ discard block |
||
| 538 | 538 | 'public' => true, |
| 539 | 539 | '_builtin' => false |
| 540 | 540 | ); |
| 541 | - $post_types = get_post_types($args , 'names'); |
|
| 542 | - foreach($post_types as $post_type){ |
|
| 541 | + $post_types = get_post_types($args, 'names'); |
|
| 542 | + foreach ($post_types as $post_type) { |
|
| 543 | 543 | |
| 544 | 544 | $post_type_args = array( |
| 545 | 545 | 'post_type' => 'page', |
@@ -550,19 +550,19 @@ discard block |
||
| 550 | 550 | $post_type_items = new WP_Query($post_type_args); |
| 551 | 551 | |
| 552 | 552 | $post_type_object = get_post_type_object($post_type); |
| 553 | - if(null != $post_type_object){ |
|
| 553 | + if (null != $post_type_object) { |
|
| 554 | 554 | $title = $post_type_object->labels->name; |
| 555 | - }else{ |
|
| 555 | + } else { |
|
| 556 | 556 | $title = ucwords($post_type); |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - if($post_type_items->have_posts()){ |
|
| 559 | + if ($post_type_items->have_posts()) { |
|
| 560 | 560 | |
| 561 | - printf( '<h2>'.__( '%1$s', 'lsx' ).'</h2>', $title ); |
|
| 561 | + printf('<h2>' . __('%1$s', 'lsx') . '</h2>', $title); |
|
| 562 | 562 | |
| 563 | 563 | echo '<ul>'; |
| 564 | - while($post_type_items->have_posts()){ $post_type_items->the_post(); |
|
| 565 | - echo '<li class="'.get_post_type().'_item '.get_post_type().'-item-'.get_the_ID().'"><a href="'.get_permalink().'" title="">'.get_the_title().'</a></li>'; |
|
| 564 | + while ($post_type_items->have_posts()) { $post_type_items->the_post(); |
|
| 565 | + echo '<li class="' . get_post_type() . '_item ' . get_post_type() . '-item-' . get_the_ID() . '"><a href="' . get_permalink() . '" title="">' . get_the_title() . '</a></li>'; |
|
| 566 | 566 | } |
| 567 | 567 | echo '</ul>'; |
| 568 | 568 | |
@@ -578,20 +578,20 @@ discard block |
||
| 578 | 578 | * @subpackage template-tags |
| 579 | 579 | * @category sitemap |
| 580 | 580 | */ |
| 581 | -function lsx_sitemap_taxonomy_clouds(){ |
|
| 581 | +function lsx_sitemap_taxonomy_clouds() { |
|
| 582 | 582 | |
| 583 | - $taxonomy_args = array( |
|
| 583 | + $taxonomy_args = array( |
|
| 584 | 584 | 'public' => true, |
| 585 | 585 | '_builtin' => false |
| 586 | 586 | ); |
| 587 | 587 | $taxonomies = get_taxonomies($taxonomy_args); |
| 588 | - if(!empty($taxonomies)){ |
|
| 589 | - foreach($taxonomies as $taxonomy_id => $taxonomy) { |
|
| 588 | + if ( ! empty($taxonomies)) { |
|
| 589 | + foreach ($taxonomies as $taxonomy_id => $taxonomy) { |
|
| 590 | 590 | |
| 591 | - $tag_cloud = wp_tag_cloud(array('taxonomy'=>$taxonomy_id,'echo'=>false)); |
|
| 592 | - if(null != $tag_cloud){ |
|
| 593 | - printf( '<h2>'.__( '%1$s', 'lsx' ).'</h2>', $taxonomy ); |
|
| 594 | - echo '<aside id="'.$taxonomy_id.'" class="widget widget_'.$taxonomy_id.'">'.$tag_cloud.'</aside>'; |
|
| 591 | + $tag_cloud = wp_tag_cloud(array('taxonomy'=>$taxonomy_id, 'echo'=>false)); |
|
| 592 | + if (null != $tag_cloud) { |
|
| 593 | + printf('<h2>' . __('%1$s', 'lsx') . '</h2>', $taxonomy); |
|
| 594 | + echo '<aside id="' . $taxonomy_id . '" class="widget widget_' . $taxonomy_id . '">' . $tag_cloud . '</aside>'; |
|
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | 597 | } |
@@ -604,15 +604,15 @@ discard block |
||
| 604 | 604 | * @subpackage hooks |
| 605 | 605 | * @category forms |
| 606 | 606 | */ |
| 607 | -add_action( 'lsx_footer_before', 'lsx_footer_subscription_cta', 10 ); |
|
| 607 | +add_action('lsx_footer_before', 'lsx_footer_subscription_cta', 10); |
|
| 608 | 608 | function lsx_footer_subscription_cta() { |
| 609 | - if(!function_exists('lsx_is_form_enabled')){ return; } |
|
| 609 | + if ( ! function_exists('lsx_is_form_enabled')) { return; } |
|
| 610 | 610 | $subscribe_form_id = lsx_is_form_enabled('subscribe'); |
| 611 | - if(false == $subscribe_form_id) { return; } |
|
| 611 | + if (false == $subscribe_form_id) { return; } |
|
| 612 | 612 | |
| 613 | 613 | //add Caldera Forms Fields Scripts |
| 614 | - if( defined( 'CFCORE_VER' ) ){ |
|
| 615 | - wp_enqueue_script( 'cf-frontend-fields', CFCORE_URL . 'assets/js/fields.min.js', array('jquery'), CFCORE_VER ); |
|
| 614 | + if (defined('CFCORE_VER')) { |
|
| 615 | + wp_enqueue_script('cf-frontend-fields', CFCORE_URL . 'assets/js/fields.min.js', array('jquery'), CFCORE_VER); |
|
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | ?> |
@@ -620,8 +620,8 @@ discard block |
||
| 620 | 620 | <div class="container"> |
| 621 | 621 | <div class="row"> |
| 622 | 622 | <div class="col-md-12"> |
| 623 | - <h2><?php _e( 'Subscribe to Our Newsletter', 'lsx' ); ?></h2> |
|
| 624 | - <?php echo do_shortcode( '[caldera_form id="'.$subscribe_form_id.'"]' ); ?> |
|
| 623 | + <h2><?php _e('Subscribe to Our Newsletter', 'lsx'); ?></h2> |
|
| 624 | + <?php echo do_shortcode('[caldera_form id="' . $subscribe_form_id . '"]'); ?> |
|
| 625 | 625 | </div> |
| 626 | 626 | </div> |
| 627 | 627 | </div> |
@@ -636,14 +636,14 @@ discard block |
||
| 636 | 636 | * @subpackage hooks |
| 637 | 637 | * @category menu |
| 638 | 638 | */ |
| 639 | -add_action( 'lsx_header_top', 'lsx_add_top_menu' ); |
|
| 639 | +add_action('lsx_header_top', 'lsx_add_top_menu'); |
|
| 640 | 640 | function lsx_add_top_menu() { |
| 641 | 641 | if (has_nav_menu('top-menu')) { ?> |
| 642 | 642 | <div id="top-menu" class="<?php lsx_top_menu_classes(); ?>"> |
| 643 | 643 | <div class="container"> |
| 644 | 644 | <nav class="top-menu"> |
| 645 | 645 | <?php |
| 646 | - wp_nav_menu( array( |
|
| 646 | + wp_nav_menu(array( |
|
| 647 | 647 | 'theme_location' => 'top-menu', |
| 648 | 648 | 'walker' => new lsx_bootstrap_navwalker()) |
| 649 | 649 | ); |
@@ -661,24 +661,24 @@ discard block |
||
| 661 | 661 | * @subpackage template-tag |
| 662 | 662 | * @category forms |
| 663 | 663 | */ |
| 664 | -if ( class_exists('Caldera_Forms') && !function_exists( 'lsx_is_form_enabled' ) ) { |
|
| 664 | +if (class_exists('Caldera_Forms') && ! function_exists('lsx_is_form_enabled')) { |
|
| 665 | 665 | function lsx_is_form_enabled($slug = false) { |
| 666 | - if(false == $slug){ return false; } |
|
| 666 | + if (false == $slug) { return false; } |
|
| 667 | 667 | |
| 668 | 668 | $match = false; |
| 669 | - $forms = get_option( '_caldera_forms' , false ); |
|
| 670 | - if(false !== $forms ) { |
|
| 671 | - foreach($forms as $form_id=>$form_maybe){ |
|
| 672 | - if( trim(strtolower($slug)) == strtolower($form_maybe['name']) ){ |
|
| 669 | + $forms = get_option('_caldera_forms', false); |
|
| 670 | + if (false !== $forms) { |
|
| 671 | + foreach ($forms as $form_id=>$form_maybe) { |
|
| 672 | + if (trim(strtolower($slug)) == strtolower($form_maybe['name'])) { |
|
| 673 | 673 | $match = $form_id; |
| 674 | 674 | break; |
| 675 | 675 | } |
| 676 | 676 | } |
| 677 | 677 | } |
| 678 | - if( false === $match ){ |
|
| 679 | - $is_form = Caldera_Forms::get_form( strtolower( $slug ) ); |
|
| 680 | - if( !empty( $is_form ) ){ |
|
| 681 | - return strtolower( $slug ); |
|
| 678 | + if (false === $match) { |
|
| 679 | + $is_form = Caldera_Forms::get_form(strtolower($slug)); |
|
| 680 | + if ( ! empty($is_form)) { |
|
| 681 | + return strtolower($slug); |
|
| 682 | 682 | } |
| 683 | 683 | } |
| 684 | 684 | |
@@ -694,10 +694,10 @@ discard block |
||
| 694 | 694 | * @category urls |
| 695 | 695 | */ |
| 696 | 696 | function lsx_get_my_url() { |
| 697 | - if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) |
|
| 697 | + if ( ! preg_match('/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches)) |
|
| 698 | 698 | return false; |
| 699 | 699 | |
| 700 | - return esc_url_raw( $matches[1] ); |
|
| 700 | + return esc_url_raw($matches[1]); |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
@@ -707,19 +707,19 @@ discard block |
||
| 707 | 707 | * @subpackage extras |
| 708 | 708 | * @category urls |
| 709 | 709 | */ |
| 710 | -function lsx_get_template_part($slug,$part) { |
|
| 710 | +function lsx_get_template_part($slug, $part) { |
|
| 711 | 711 | $template = array(); |
| 712 | 712 | $part = (string) $part; |
| 713 | - if ( '' !== $part ){ |
|
| 713 | + if ('' !== $part) { |
|
| 714 | 714 | $template = "{$slug}-{$part}.php"; |
| 715 | - }else{ |
|
| 715 | + } else { |
|
| 716 | 716 | $template = "{$slug}.php"; |
| 717 | 717 | } |
| 718 | - $file_path = apply_filters('lsx_content_path',false,$slug,$part); |
|
| 718 | + $file_path = apply_filters('lsx_content_path', false, $slug, $part); |
|
| 719 | 719 | |
| 720 | - if ( false !== $file_path && '' == locate_template( array( $template ) ) && file_exists( $file_path.$template) ) { |
|
| 721 | - load_template( $file_path.$template, false ); |
|
| 722 | - }else{ |
|
| 723 | - get_template_part($slug,$part); |
|
| 720 | + if (false !== $file_path && '' == locate_template(array($template)) && file_exists($file_path . $template)) { |
|
| 721 | + load_template($file_path . $template, false); |
|
| 722 | + } else { |
|
| 723 | + get_template_part($slug, $part); |
|
| 724 | 724 | } |
| 725 | 725 | } |
| 726 | 726 | \ No newline at end of file |