@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | * @subpackage sanitize |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | -if ( ! function_exists( 'lsx_sanitize_choices' ) ) : |
|
13 | +if ( ! function_exists('lsx_sanitize_choices')) : |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Sanitize a value from a list of allowed values. |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | * @param mixed $setting The setting for which the sanitizing is occurring. |
23 | 23 | * @return mixed The sanitized value. |
24 | 24 | */ |
25 | - function lsx_sanitize_choices( $value, $setting ) { |
|
26 | - if ( is_object( $setting ) ) { |
|
25 | + function lsx_sanitize_choices($value, $setting) { |
|
26 | + if (is_object($setting)) { |
|
27 | 27 | $setting = $setting->id; |
28 | 28 | } |
29 | 29 | |
30 | - $choices = lsx_customizer_sanitize_get_choices( $setting ); |
|
30 | + $choices = lsx_customizer_sanitize_get_choices($setting); |
|
31 | 31 | |
32 | - if ( ! is_wp_error( $choices ) && ! empty( $choices ) ) { |
|
33 | - $allowed_choices = array_keys( $choices ); |
|
32 | + if ( ! is_wp_error($choices) && ! empty($choices)) { |
|
33 | + $allowed_choices = array_keys($choices); |
|
34 | 34 | |
35 | - if ( ! in_array( $value, $allowed_choices ) ) { |
|
36 | - $value = lsx_customizer_sanitize_get_default( $setting ); |
|
35 | + if ( ! in_array($value, $allowed_choices)) { |
|
36 | + $value = lsx_customizer_sanitize_get_default($setting); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $value; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | endif; |
46 | 46 | |
47 | -if ( ! function_exists( 'lsx_customizer_sanitize_get_choices' ) ) : |
|
47 | +if ( ! function_exists('lsx_customizer_sanitize_get_choices')) : |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Helper function to return the choices for a field. |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @param string |
56 | 56 | * @return mixed $field |
57 | 57 | */ |
58 | - function lsx_customizer_sanitize_get_choices( $id ) { |
|
58 | + function lsx_customizer_sanitize_get_choices($id) { |
|
59 | 59 | global $lsx_customizer; |
60 | 60 | |
61 | - $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
62 | - $field = $lsx_customizer->get_control( $id ); |
|
61 | + $can_validate = method_exists('WP_Customize_Setting', 'validate'); |
|
62 | + $field = $lsx_customizer->get_control($id); |
|
63 | 63 | |
64 | - if ( ! isset( $field['choices'] ) ) { |
|
65 | - return $can_validate ? new WP_Error( 'notexists', esc_html__( 'Choice doesn\'t exist', 'lsx' ) ) : false; |
|
64 | + if ( ! isset($field['choices'])) { |
|
65 | + return $can_validate ? new WP_Error('notexists', esc_html__('Choice doesn\'t exist', 'lsx')) : false; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | return $field['choices']; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | endif; |
72 | 72 | |
73 | -if ( ! function_exists( 'lsx_customizer_sanitize_get_default' ) ) : |
|
73 | +if ( ! function_exists('lsx_customizer_sanitize_get_default')) : |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Helper function to return defaults. |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @param string |
82 | 82 | * @return mixed $default |
83 | 83 | */ |
84 | - function lsx_customizer_sanitize_get_default( $id ) { |
|
84 | + function lsx_customizer_sanitize_get_default($id) { |
|
85 | 85 | global $lsx_customizer; |
86 | - $setting = $lsx_customizer->get_setting( $id ); |
|
86 | + $setting = $lsx_customizer->get_setting($id); |
|
87 | 87 | |
88 | - if ( isset( $setting['default'] ) ) { |
|
88 | + if (isset($setting['default'])) { |
|
89 | 89 | return $setting['default']; |
90 | 90 | } |
91 | 91 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | endif; |
96 | 96 | |
97 | -if ( ! function_exists( 'lsx_sanitize_checkbox' ) ) : |
|
97 | +if ( ! function_exists('lsx_sanitize_checkbox')) : |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Sanitizes an single or multiple checkbox input. |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | * @param array $input |
106 | 106 | * @return array $output |
107 | 107 | */ |
108 | - function lsx_sanitize_checkbox( $input ) { |
|
109 | - $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
108 | + function lsx_sanitize_checkbox($input) { |
|
109 | + $can_validate = method_exists('WP_Customize_Setting', 'validate'); |
|
110 | 110 | |
111 | - if ( ! is_bool( $input ) ) { |
|
112 | - return $can_validate ? new WP_Error( 'notboolean', esc_html__( 'Not a boolean', 'lsx' ) ) : false; |
|
111 | + if ( ! is_bool($input)) { |
|
112 | + return $can_validate ? new WP_Error('notboolean', esc_html__('Not a boolean', 'lsx')) : false; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $input; |
@@ -7,112 +7,112 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | if ( ! function_exists( 'lsx_sanitize_choices' ) ) : |
14 | 14 | |
15 | - /** |
|
16 | - * Sanitize a value from a list of allowed values. |
|
17 | - * |
|
18 | - * @package lsx |
|
19 | - * @subpackage sanitize |
|
20 | - * |
|
21 | - * @param mixed $value The value to sanitize. |
|
22 | - * @param mixed $setting The setting for which the sanitizing is occurring. |
|
23 | - * @return mixed The sanitized value. |
|
24 | - */ |
|
25 | - function lsx_sanitize_choices( $value, $setting ) { |
|
26 | - if ( is_object( $setting ) ) { |
|
27 | - $setting = $setting->id; |
|
28 | - } |
|
29 | - |
|
30 | - $choices = lsx_customizer_sanitize_get_choices( $setting ); |
|
31 | - |
|
32 | - if ( ! is_wp_error( $choices ) && ! empty( $choices ) ) { |
|
33 | - $allowed_choices = array_keys( $choices ); |
|
34 | - |
|
35 | - if ( ! in_array( $value, $allowed_choices ) ) { |
|
36 | - $value = lsx_customizer_sanitize_get_default( $setting ); |
|
37 | - } |
|
38 | - |
|
39 | - return $value; |
|
40 | - } else { |
|
41 | - return $choices; |
|
42 | - } |
|
43 | - } |
|
15 | + /** |
|
16 | + * Sanitize a value from a list of allowed values. |
|
17 | + * |
|
18 | + * @package lsx |
|
19 | + * @subpackage sanitize |
|
20 | + * |
|
21 | + * @param mixed $value The value to sanitize. |
|
22 | + * @param mixed $setting The setting for which the sanitizing is occurring. |
|
23 | + * @return mixed The sanitized value. |
|
24 | + */ |
|
25 | + function lsx_sanitize_choices( $value, $setting ) { |
|
26 | + if ( is_object( $setting ) ) { |
|
27 | + $setting = $setting->id; |
|
28 | + } |
|
29 | + |
|
30 | + $choices = lsx_customizer_sanitize_get_choices( $setting ); |
|
31 | + |
|
32 | + if ( ! is_wp_error( $choices ) && ! empty( $choices ) ) { |
|
33 | + $allowed_choices = array_keys( $choices ); |
|
34 | + |
|
35 | + if ( ! in_array( $value, $allowed_choices ) ) { |
|
36 | + $value = lsx_customizer_sanitize_get_default( $setting ); |
|
37 | + } |
|
38 | + |
|
39 | + return $value; |
|
40 | + } else { |
|
41 | + return $choices; |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | 45 | endif; |
46 | 46 | |
47 | 47 | if ( ! function_exists( 'lsx_customizer_sanitize_get_choices' ) ) : |
48 | 48 | |
49 | - /** |
|
50 | - * Helper function to return the choices for a field. |
|
51 | - * |
|
52 | - * @package lsx |
|
53 | - * @subpackage sanitize |
|
54 | - * |
|
55 | - * @param string |
|
56 | - * @return mixed $field |
|
57 | - */ |
|
58 | - function lsx_customizer_sanitize_get_choices( $id ) { |
|
59 | - global $lsx_customizer; |
|
49 | + /** |
|
50 | + * Helper function to return the choices for a field. |
|
51 | + * |
|
52 | + * @package lsx |
|
53 | + * @subpackage sanitize |
|
54 | + * |
|
55 | + * @param string |
|
56 | + * @return mixed $field |
|
57 | + */ |
|
58 | + function lsx_customizer_sanitize_get_choices( $id ) { |
|
59 | + global $lsx_customizer; |
|
60 | 60 | |
61 | - $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
62 | - $field = $lsx_customizer->get_control( $id ); |
|
61 | + $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
62 | + $field = $lsx_customizer->get_control( $id ); |
|
63 | 63 | |
64 | - if ( ! isset( $field['choices'] ) ) { |
|
65 | - return $can_validate ? new WP_Error( 'notexists', esc_html__( 'Choice doesn\'t exist', 'lsx' ) ) : false; |
|
66 | - } |
|
64 | + if ( ! isset( $field['choices'] ) ) { |
|
65 | + return $can_validate ? new WP_Error( 'notexists', esc_html__( 'Choice doesn\'t exist', 'lsx' ) ) : false; |
|
66 | + } |
|
67 | 67 | |
68 | - return $field['choices']; |
|
69 | - } |
|
68 | + return $field['choices']; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | endif; |
72 | 72 | |
73 | 73 | if ( ! function_exists( 'lsx_customizer_sanitize_get_default' ) ) : |
74 | 74 | |
75 | - /** |
|
76 | - * Helper function to return defaults. |
|
77 | - * |
|
78 | - * @package lsx |
|
79 | - * @subpackage sanitize |
|
80 | - * |
|
81 | - * @param string |
|
82 | - * @return mixed $default |
|
83 | - */ |
|
84 | - function lsx_customizer_sanitize_get_default( $id ) { |
|
85 | - global $lsx_customizer; |
|
86 | - $setting = $lsx_customizer->get_setting( $id ); |
|
87 | - |
|
88 | - if ( isset( $setting['default'] ) ) { |
|
89 | - return $setting['default']; |
|
90 | - } |
|
91 | - |
|
92 | - return false; |
|
93 | - } |
|
75 | + /** |
|
76 | + * Helper function to return defaults. |
|
77 | + * |
|
78 | + * @package lsx |
|
79 | + * @subpackage sanitize |
|
80 | + * |
|
81 | + * @param string |
|
82 | + * @return mixed $default |
|
83 | + */ |
|
84 | + function lsx_customizer_sanitize_get_default( $id ) { |
|
85 | + global $lsx_customizer; |
|
86 | + $setting = $lsx_customizer->get_setting( $id ); |
|
87 | + |
|
88 | + if ( isset( $setting['default'] ) ) { |
|
89 | + return $setting['default']; |
|
90 | + } |
|
91 | + |
|
92 | + return false; |
|
93 | + } |
|
94 | 94 | |
95 | 95 | endif; |
96 | 96 | |
97 | 97 | if ( ! function_exists( 'lsx_sanitize_checkbox' ) ) : |
98 | 98 | |
99 | - /** |
|
100 | - * Sanitizes an single or multiple checkbox input. |
|
101 | - * |
|
102 | - * @package lsx |
|
103 | - * @subpackage sanitize |
|
104 | - * |
|
105 | - * @param array $input |
|
106 | - * @return array $output |
|
107 | - */ |
|
108 | - function lsx_sanitize_checkbox( $input ) { |
|
109 | - $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
110 | - |
|
111 | - if ( ! is_bool( $input ) ) { |
|
112 | - return $can_validate ? new WP_Error( 'notboolean', esc_html__( 'Not a boolean', 'lsx' ) ) : false; |
|
113 | - } |
|
114 | - |
|
115 | - return $input; |
|
116 | - } |
|
99 | + /** |
|
100 | + * Sanitizes an single or multiple checkbox input. |
|
101 | + * |
|
102 | + * @package lsx |
|
103 | + * @subpackage sanitize |
|
104 | + * |
|
105 | + * @param array $input |
|
106 | + * @return array $output |
|
107 | + */ |
|
108 | + function lsx_sanitize_checkbox( $input ) { |
|
109 | + $can_validate = method_exists( 'WP_Customize_Setting', 'validate' ); |
|
110 | + |
|
111 | + if ( ! is_bool( $input ) ) { |
|
112 | + return $can_validate ? new WP_Error( 'notboolean', esc_html__( 'Not a boolean', 'lsx' ) ) : false; |
|
113 | + } |
|
114 | + |
|
115 | + return $input; |
|
116 | + } |
|
117 | 117 | |
118 | 118 | endif; |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | * @category layout |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | -if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
14 | +if ( ! class_exists('WP_Customize_Control')) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'LSX_Customize_Layout_Control' ) ) : |
|
18 | +if ( ! class_exists('LSX_Customize_Layout_Control')) : |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * LSX_Customize_Layout_Control Class. |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | public $statuses; |
31 | 31 | public $layouts = array(); |
32 | 32 | |
33 | - public function __construct( $manager, $id, $args = array() ) { |
|
34 | - parent::__construct( $manager, $id, $args ); |
|
35 | - if ( ! empty( $args['choices'] ) ) { |
|
33 | + public function __construct($manager, $id, $args = array()) { |
|
34 | + parent::__construct($manager, $id, $args); |
|
35 | + if ( ! empty($args['choices'])) { |
|
36 | 36 | $this->layouts = $args['choices']; |
37 | 37 | } |
38 | 38 | } |
@@ -41,39 +41,39 @@ discard block |
||
41 | 41 | * Enqueue scripts/styles for the color picker. |
42 | 42 | */ |
43 | 43 | public function enqueue() { |
44 | - wp_enqueue_script( 'lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
44 | + wp_enqueue_script('lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array('jquery'), LSX_VERSION, true); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Render output. |
49 | 49 | */ |
50 | 50 | public function render_content() { |
51 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
51 | + $post_id = 'customize-control-' . str_replace('[', '-', str_replace(']', '', $this->id)); |
|
52 | 52 | $class = 'customize-control customize-control-' . $this->type; |
53 | 53 | $value = $this->value(); |
54 | 54 | ?> |
55 | 55 | <label> |
56 | 56 | <?php |
57 | - if ( ! empty( $this->label ) ) { |
|
57 | + if ( ! empty($this->label)) { |
|
58 | 58 | ?> |
59 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
59 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
60 | 60 | <?php |
61 | 61 | } |
62 | - if ( ! empty( $this->description ) ) { |
|
62 | + if ( ! empty($this->description)) { |
|
63 | 63 | ?> |
64 | - <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
64 | + <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span> |
|
65 | 65 | <?php } ?> |
66 | 66 | <div class="layouts-selector"> |
67 | 67 | <?php |
68 | - foreach ( $this->layouts as $layout ) { |
|
68 | + foreach ($this->layouts as $layout) { |
|
69 | 69 | $sel = 'border: 1px solid transparent;'; |
70 | - if ( $value === $layout ) { |
|
70 | + if ($value === $layout) { |
|
71 | 71 | $sel = 'border: 1px solid rgb(43, 166, 203);'; |
72 | 72 | } |
73 | - echo '<img class="layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
73 | + echo '<img class="layout-button" style="padding:2px;' . esc_attr($sel) . '" src="' . esc_attr(get_template_directory_uri()) . '/assets/images/admin/' . esc_attr($layout) . '.png" data-option="' . esc_attr($layout) . '">'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | - <input <?php $this->link(); ?> class="selected-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
|
76 | + <input <?php $this->link(); ?> class="selected-layout <?php echo esc_attr($class); ?>" id="<?php echo esc_attr($post_id); ?>" type="hidden" value="<?php echo esc_attr($value); ?>" <?php $this->input_attrs(); ?>> |
|
77 | 77 | </div> |
78 | 78 | </label> |
79 | 79 | <?php |
@@ -8,77 +8,77 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; |
|
11 | + exit; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | if ( ! class_exists( 'WP_Customize_Control' ) ) { |
15 | - return; |
|
15 | + return; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if ( ! class_exists( 'LSX_Customize_Layout_Control' ) ) : |
19 | 19 | |
20 | - /** |
|
21 | - * LSX_Customize_Layout_Control Class. |
|
22 | - * |
|
23 | - * @package lsx |
|
24 | - * @subpackage customizer |
|
25 | - * @category layout |
|
26 | - */ |
|
27 | - class LSX_Customize_Layout_Control extends WP_Customize_Control { |
|
20 | + /** |
|
21 | + * LSX_Customize_Layout_Control Class. |
|
22 | + * |
|
23 | + * @package lsx |
|
24 | + * @subpackage customizer |
|
25 | + * @category layout |
|
26 | + */ |
|
27 | + class LSX_Customize_Layout_Control extends WP_Customize_Control { |
|
28 | 28 | |
29 | - public $type = 'layout'; |
|
30 | - public $statuses; |
|
31 | - public $layouts = array(); |
|
29 | + public $type = 'layout'; |
|
30 | + public $statuses; |
|
31 | + public $layouts = array(); |
|
32 | 32 | |
33 | - public function __construct( $manager, $id, $args = array() ) { |
|
34 | - parent::__construct( $manager, $id, $args ); |
|
35 | - if ( ! empty( $args['choices'] ) ) { |
|
36 | - $this->layouts = $args['choices']; |
|
37 | - } |
|
38 | - } |
|
33 | + public function __construct( $manager, $id, $args = array() ) { |
|
34 | + parent::__construct( $manager, $id, $args ); |
|
35 | + if ( ! empty( $args['choices'] ) ) { |
|
36 | + $this->layouts = $args['choices']; |
|
37 | + } |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Enqueue scripts/styles for the color picker. |
|
42 | - */ |
|
43 | - public function enqueue() { |
|
44 | - wp_enqueue_script( 'lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
45 | - } |
|
40 | + /** |
|
41 | + * Enqueue scripts/styles for the color picker. |
|
42 | + */ |
|
43 | + public function enqueue() { |
|
44 | + wp_enqueue_script( 'lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Render output. |
|
49 | - */ |
|
50 | - public function render_content() { |
|
51 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
52 | - $class = 'customize-control customize-control-' . $this->type; |
|
53 | - $value = $this->value(); |
|
54 | - ?> |
|
47 | + /** |
|
48 | + * Render output. |
|
49 | + */ |
|
50 | + public function render_content() { |
|
51 | + $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
52 | + $class = 'customize-control customize-control-' . $this->type; |
|
53 | + $value = $this->value(); |
|
54 | + ?> |
|
55 | 55 | <label> |
56 | 56 | <?php |
57 | - if ( ! empty( $this->label ) ) { |
|
58 | - ?> |
|
57 | + if ( ! empty( $this->label ) ) { |
|
58 | + ?> |
|
59 | 59 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
60 | 60 | <?php |
61 | - } |
|
62 | - if ( ! empty( $this->description ) ) { |
|
63 | - ?> |
|
61 | + } |
|
62 | + if ( ! empty( $this->description ) ) { |
|
63 | + ?> |
|
64 | 64 | <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
65 | 65 | <?php } ?> |
66 | 66 | <div class="layouts-selector"> |
67 | 67 | <?php |
68 | - foreach ( $this->layouts as $layout ) { |
|
69 | - $sel = 'border: 1px solid transparent;'; |
|
70 | - if ( $value === $layout ) { |
|
71 | - $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
72 | - } |
|
73 | - echo '<img class="layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
74 | - } |
|
75 | - ?> |
|
68 | + foreach ( $this->layouts as $layout ) { |
|
69 | + $sel = 'border: 1px solid transparent;'; |
|
70 | + if ( $value === $layout ) { |
|
71 | + $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
72 | + } |
|
73 | + echo '<img class="layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
74 | + } |
|
75 | + ?> |
|
76 | 76 | <input <?php $this->link(); ?> class="selected-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
77 | 77 | </div> |
78 | 78 | </label> |
79 | 79 | <?php |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | endif; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
12 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
13 | 13 | |
14 | 14 | <?php lsx_content_before(); ?> |
15 | 15 | |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php lsx_content_top(); ?> |
19 | 19 | |
20 | - <?php if ( have_posts() ) : ?> |
|
20 | + <?php if (have_posts()) : ?> |
|
21 | 21 | |
22 | 22 | <?php |
23 | - while ( have_posts() ) : |
|
23 | + while (have_posts()) : |
|
24 | 24 | the_post(); |
25 | 25 | ?> |
26 | 26 | |
27 | 27 | <?php |
28 | - if ( is_singular( 'post' ) ) { |
|
29 | - get_template_part( 'partials/content', 'post' ); |
|
28 | + if (is_singular('post')) { |
|
29 | + get_template_part('partials/content', 'post'); |
|
30 | 30 | } else { |
31 | - get_template_part( 'partials/content', 'custom' ); |
|
31 | + get_template_part('partials/content', 'custom'); |
|
32 | 32 | } |
33 | 33 | ?> |
34 | 34 | |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | <?php lsx_content_after(); ?> |
44 | 44 | |
45 | 45 | <?php |
46 | - if ( is_singular( 'post' ) ) { |
|
46 | + if (is_singular('post')) { |
|
47 | 47 | lsx_post_nav(); |
48 | 48 | } |
49 | 49 | ?> |
50 | 50 | |
51 | 51 | <?php |
52 | - if ( comments_open() ) { |
|
52 | + if (comments_open()) { |
|
53 | 53 | comments_template(); |
54 | 54 | } |
55 | 55 | ?> |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | <?php if ( have_posts() ) : ?> |
21 | 21 | |
22 | 22 | <?php |
23 | - while ( have_posts() ) : |
|
24 | - the_post(); |
|
25 | - ?> |
|
23 | + while ( have_posts() ) : |
|
24 | + the_post(); |
|
25 | + ?> |
|
26 | 26 | |
27 | 27 | <?php |
28 | - if ( is_singular( 'post' ) ) { |
|
29 | - get_template_part( 'partials/content', 'post' ); |
|
30 | - } else { |
|
31 | - get_template_part( 'partials/content', 'custom' ); |
|
32 | - } |
|
33 | - ?> |
|
28 | + if ( is_singular( 'post' ) ) { |
|
29 | + get_template_part( 'partials/content', 'post' ); |
|
30 | + } else { |
|
31 | + get_template_part( 'partials/content', 'custom' ); |
|
32 | + } |
|
33 | + ?> |
|
34 | 34 | |
35 | 35 | <?php endwhile; ?> |
36 | 36 | |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | <?php lsx_content_after(); ?> |
44 | 44 | |
45 | 45 | <?php |
46 | - if ( is_singular( 'post' ) ) { |
|
47 | - lsx_post_nav(); |
|
48 | - } |
|
49 | - ?> |
|
46 | + if ( is_singular( 'post' ) ) { |
|
47 | + lsx_post_nav(); |
|
48 | + } |
|
49 | + ?> |
|
50 | 50 | |
51 | 51 | <?php |
52 | - if ( comments_open() ) { |
|
53 | - comments_template(); |
|
54 | - } |
|
55 | - ?> |
|
52 | + if ( comments_open() ) { |
|
53 | + comments_template(); |
|
54 | + } |
|
55 | + ?> |
|
56 | 56 | |
57 | 57 | </div><!-- #primary --> |
58 | 58 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | <?php lsx_content_wrap_before(); ?> |
14 | 14 | |
15 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
15 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
16 | 16 | |
17 | 17 | <?php lsx_content_before(); ?> |
18 | 18 | |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | |
21 | 21 | <?php lsx_content_top(); ?> |
22 | 22 | |
23 | - <?php if ( have_posts() ) : ?> |
|
23 | + <?php if (have_posts()) : ?> |
|
24 | 24 | |
25 | 25 | <?php |
26 | - while ( have_posts() ) : |
|
26 | + while (have_posts()) : |
|
27 | 27 | the_post(); |
28 | 28 | ?> |
29 | 29 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | <?php lsx_content_wrap_after(); ?> |
59 | 59 | |
60 | -<?php get_sidebar( 'sitemap' ); ?> |
|
60 | +<?php get_sidebar('sitemap'); ?> |
|
61 | 61 | |
62 | 62 | <?php |
63 | 63 | get_footer(); |
@@ -23,9 +23,9 @@ |
||
23 | 23 | <?php if ( have_posts() ) : ?> |
24 | 24 | |
25 | 25 | <?php |
26 | - while ( have_posts() ) : |
|
27 | - the_post(); |
|
28 | - ?> |
|
26 | + while ( have_posts() ) : |
|
27 | + the_post(); |
|
28 | + ?> |
|
29 | 29 | |
30 | 30 | <?php lsx_entry_before(); ?> |
31 | 31 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | <?php lsx_content_wrap_before(); ?> |
14 | 14 | |
15 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
15 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
16 | 16 | |
17 | 17 | <?php lsx_content_before(); ?> |
18 | 18 | |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | |
21 | 21 | <?php lsx_content_top(); ?> |
22 | 22 | |
23 | - <?php if ( have_posts() ) : ?> |
|
23 | + <?php if (have_posts()) : ?> |
|
24 | 24 | |
25 | 25 | <?php |
26 | - while ( have_posts() ) : |
|
26 | + while (have_posts()) : |
|
27 | 27 | the_post(); |
28 | 28 | ?> |
29 | 29 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <?php lsx_entry_top(); ?> |
35 | 35 | |
36 | 36 | <div class="entry-content"> |
37 | - <h2><?php esc_html_e( 'The Last 30 Posts', 'lsx' ); ?></h2> |
|
37 | + <h2><?php esc_html_e('The Last 30 Posts', 'lsx'); ?></h2> |
|
38 | 38 | |
39 | 39 | <ul> |
40 | 40 | <?php |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | ); |
46 | 46 | ?> |
47 | 47 | |
48 | - <?php if ( $loop->have_posts() ) : ?> |
|
48 | + <?php if ($loop->have_posts()) : ?> |
|
49 | 49 | |
50 | - <?php while ( $loop->have_posts() ) : ?> |
|
50 | + <?php while ($loop->have_posts()) : ?> |
|
51 | 51 | |
52 | 52 | <?php |
53 | 53 | $loop->the_post(); |
54 | 54 | $loop->is_home = false; |
55 | 55 | ?> |
56 | 56 | |
57 | - <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php the_time( get_option( 'date_format' ) ); ?> - <?php echo esc_html( $post->comment_count ); ?> <?php esc_html_e( 'comments', 'lsx' ); ?></li> |
|
57 | + <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php the_time(get_option('date_format')); ?> - <?php echo esc_html($post->comment_count); ?> <?php esc_html_e('comments', 'lsx'); ?></li> |
|
58 | 58 | |
59 | 59 | <?php endwhile; ?> |
60 | 60 | |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | <?php wp_reset_postdata(); ?> |
64 | 64 | </ul> |
65 | 65 | |
66 | - <h2><?php esc_html_e( 'Categories', 'lsx' ); ?></h2> |
|
66 | + <h2><?php esc_html_e('Categories', 'lsx'); ?></h2> |
|
67 | 67 | |
68 | 68 | <ul> |
69 | - <?php wp_list_categories( 'title_li=&hierarchical=0&show_count=1' ); ?> |
|
69 | + <?php wp_list_categories('title_li=&hierarchical=0&show_count=1'); ?> |
|
70 | 70 | </ul> |
71 | 71 | |
72 | - <h2><?php esc_html_e( 'Monthly Archives', 'lsx' ); ?></h2> |
|
72 | + <h2><?php esc_html_e('Monthly Archives', 'lsx'); ?></h2> |
|
73 | 73 | |
74 | 74 | <ul> |
75 | - <?php wp_get_archives( 'type=monthly&show_post_count=1' ); ?> |
|
75 | + <?php wp_get_archives('type=monthly&show_post_count=1'); ?> |
|
76 | 76 | </ul> |
77 | 77 | </div><!-- .entry-content --> |
78 | 78 |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | <?php if ( have_posts() ) : ?> |
24 | 24 | |
25 | 25 | <?php |
26 | - while ( have_posts() ) : |
|
27 | - the_post(); |
|
28 | - ?> |
|
26 | + while ( have_posts() ) : |
|
27 | + the_post(); |
|
28 | + ?> |
|
29 | 29 | |
30 | 30 | <?php lsx_entry_before(); ?> |
31 | 31 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | |
39 | 39 | <ul> |
40 | 40 | <?php |
41 | - $loop = new WP_Query( |
|
42 | - array( |
|
43 | - 'posts_per_page' => 30, |
|
44 | - ) |
|
45 | - ); |
|
46 | - ?> |
|
41 | + $loop = new WP_Query( |
|
42 | + array( |
|
43 | + 'posts_per_page' => 30, |
|
44 | + ) |
|
45 | + ); |
|
46 | + ?> |
|
47 | 47 | |
48 | 48 | <?php if ( $loop->have_posts() ) : ?> |
49 | 49 | |
50 | 50 | <?php while ( $loop->have_posts() ) : ?> |
51 | 51 | |
52 | 52 | <?php |
53 | - $loop->the_post(); |
|
54 | - $loop->is_home = false; |
|
55 | - ?> |
|
53 | + $loop->the_post(); |
|
54 | + $loop->is_home = false; |
|
55 | + ?> |
|
56 | 56 | |
57 | 57 | <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php the_time( get_option( 'date_format' ) ); ?> - <?php echo esc_html( $post->comment_count ); ?> <?php esc_html_e( 'comments', 'lsx' ); ?></li> |
58 | 58 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | <?php lsx_entry_before(); ?> |
11 | 11 | |
12 | 12 | <?php |
13 | - $no_thumb_post_types = array( |
|
13 | + $no_thumb_post_types = array( |
|
14 | 14 | 'audio' => 'audio', |
15 | 15 | 'gallery' => 'gallery', |
16 | 16 | 'image' => 'image', |
@@ -18,38 +18,38 @@ discard block |
||
18 | 18 | 'quote' => 'quote', |
19 | 19 | 'video' => 'video', |
20 | 20 | ); |
21 | - $no_thumb_post_formats = apply_filters( 'lsx_no_thumb_post_formats', $no_thumb_post_types ); |
|
21 | + $no_thumb_post_formats = apply_filters('lsx_no_thumb_post_formats', $no_thumb_post_types); |
|
22 | 22 | |
23 | - $has_thumb = has_post_thumbnail() && ! has_post_format( $no_thumb_post_formats ); |
|
23 | + $has_thumb = has_post_thumbnail() && ! has_post_format($no_thumb_post_formats); |
|
24 | 24 | |
25 | - if ( $has_thumb ) { |
|
25 | + if ($has_thumb) { |
|
26 | 26 | $thumb_class = 'has-thumb'; |
27 | 27 | } else { |
28 | 28 | $thumb_class = 'no-thumb'; |
29 | 29 | } |
30 | 30 | |
31 | - $blog_layout = apply_filters( 'lsx_blog_layout', 'default' ); |
|
31 | + $blog_layout = apply_filters('lsx_blog_layout', 'default'); |
|
32 | 32 | |
33 | 33 | $image_class = ''; |
34 | 34 | |
35 | - $thumbnail_id = get_post_thumbnail_id( get_the_ID() ); |
|
36 | - $image_arr = wp_get_attachment_image_src( $thumbnail_id, 'lsx-thumbnail-single' ); |
|
35 | + $thumbnail_id = get_post_thumbnail_id(get_the_ID()); |
|
36 | + $image_arr = wp_get_attachment_image_src($thumbnail_id, 'lsx-thumbnail-single'); |
|
37 | 37 | |
38 | - if ( is_array( $image_arr ) ) { |
|
38 | + if (is_array($image_arr)) { |
|
39 | 39 | $image_src = $image_arr[0]; |
40 | 40 | } |
41 | 41 | ?> |
42 | 42 | |
43 | -<article id="post-<?php the_ID(); ?>" <?php post_class( array( 'lsx-slot', $thumb_class ) ); ?>> |
|
43 | +<article id="post-<?php the_ID(); ?>" <?php post_class(array('lsx-slot', $thumb_class)); ?>> |
|
44 | 44 | <?php lsx_entry_top(); ?> |
45 | 45 | |
46 | 46 | <div class="entry-layout"> |
47 | 47 | <div class="entry-layout-content entry-layout-content-<?php echo has_post_thumbnail() ? '67' : '100'; ?>"> |
48 | 48 | <header class="entry-header"> |
49 | - <?php if ( $has_thumb ) : ?> |
|
50 | - <div class="entry-image <?php echo esc_attr( $image_class ); ?>"> |
|
49 | + <?php if ($has_thumb) : ?> |
|
50 | + <div class="entry-image <?php echo esc_attr($image_class); ?>"> |
|
51 | 51 | <a class="thumbnail" href="<?php the_permalink(); ?>"> |
52 | - <?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?> |
|
52 | + <?php lsx_thumbnail('lsx-thumbnail-single'); ?> |
|
53 | 53 | </a> |
54 | 54 | </div> |
55 | 55 | <?php endif; ?> |
@@ -57,37 +57,37 @@ discard block |
||
57 | 57 | <?php |
58 | 58 | $format = get_post_format(); |
59 | 59 | |
60 | - if ( false === $format ) { |
|
60 | + if (false === $format) { |
|
61 | 61 | $format = 'standard'; |
62 | - $show_on_front = get_option( 'show_on_front', 'posts' ); |
|
62 | + $show_on_front = get_option('show_on_front', 'posts'); |
|
63 | 63 | |
64 | - if ( 'page' === $show_on_front ) { |
|
65 | - $archive_link = get_permalink( get_option( 'page_for_posts' ) ); |
|
64 | + if ('page' === $show_on_front) { |
|
65 | + $archive_link = get_permalink(get_option('page_for_posts')); |
|
66 | 66 | } else { |
67 | 67 | $archive_link = home_url(); |
68 | 68 | } |
69 | 69 | } else { |
70 | - $archive_link = get_post_format_link( $format ); |
|
70 | + $archive_link = get_post_format_link($format); |
|
71 | 71 | } |
72 | 72 | |
73 | - $format = lsx_translate_format_to_fontawesome( $format ); |
|
73 | + $format = lsx_translate_format_to_fontawesome($format); |
|
74 | 74 | ?> |
75 | 75 | |
76 | 76 | <h2 class="entry-title"> |
77 | - <?php if ( has_post_thumbnail() ) : ?> |
|
78 | - <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link has-thumb fa fa-<?php echo esc_attr( $format ); ?>"></a> |
|
77 | + <?php if (has_post_thumbnail()) : ?> |
|
78 | + <a href="<?php echo esc_url($archive_link); ?>" class="format-link has-thumb fa fa-<?php echo esc_attr($format); ?>"></a> |
|
79 | 79 | <?php else : ?> |
80 | - <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link fa fa-<?php echo esc_attr( $format ); ?>"></a> |
|
80 | + <a href="<?php echo esc_url($archive_link); ?>" class="format-link fa fa-<?php echo esc_attr($format); ?>"></a> |
|
81 | 81 | <?php endif; ?> |
82 | 82 | |
83 | - <?php if ( has_post_format( array( 'link' ) ) ) : ?> |
|
84 | - <a href="<?php echo esc_url( lsx_get_my_url() ); ?>" rel="bookmark"><?php the_title(); ?> <span class="fa fa-external-link"></span></a> |
|
83 | + <?php if (has_post_format(array('link'))) : ?> |
|
84 | + <a href="<?php echo esc_url(lsx_get_my_url()); ?>" rel="bookmark"><?php the_title(); ?> <span class="fa fa-external-link"></span></a> |
|
85 | 85 | <?php else : ?> |
86 | 86 | <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> |
87 | 87 | <?php endif; ?> |
88 | 88 | |
89 | - <?php if ( is_sticky() ) : ?> |
|
90 | - <span class="label label-default label-sticky"><?php esc_html_e( 'Featured', 'lsx' ); ?></span> |
|
89 | + <?php if (is_sticky()) : ?> |
|
90 | + <span class="label label-default label-sticky"><?php esc_html_e('Featured', 'lsx'); ?></span> |
|
91 | 91 | <?php endif; ?> |
92 | 92 | </h2> |
93 | 93 | <div class="entry-meta"> |
@@ -98,27 +98,27 @@ discard block |
||
98 | 98 | |
99 | 99 | </header><!-- .entry-header --> |
100 | 100 | |
101 | - <?php if ( has_post_format( array( 'quote' ) ) || apply_filters( 'lsx_blog_display_text_on_list', true ) ) : ?> |
|
101 | + <?php if (has_post_format(array('quote')) || apply_filters('lsx_blog_display_text_on_list', true)) : ?> |
|
102 | 102 | |
103 | - <?php if ( lsx_post_format_force_content_on_list() && ! apply_filters( 'lsx_blog_force_content_on_list', false ) ) : ?> |
|
103 | + <?php if (lsx_post_format_force_content_on_list() && ! apply_filters('lsx_blog_force_content_on_list', false)) : ?> |
|
104 | 104 | |
105 | 105 | <div class="entry-summary"> |
106 | 106 | <?php |
107 | - if ( ! has_excerpt() ) { |
|
107 | + if ( ! has_excerpt()) { |
|
108 | 108 | |
109 | - $excerpt_more = '<p><a class="moretag" href="' . esc_url( get_permalink() ) . '">' . esc_html__( 'Read More', 'lsx' ) . '</a></p>'; |
|
110 | - $content = wp_trim_words( get_the_content(), 50 ); |
|
109 | + $excerpt_more = '<p><a class="moretag" href="' . esc_url(get_permalink()) . '">' . esc_html__('Read More', 'lsx') . '</a></p>'; |
|
110 | + $content = wp_trim_words(get_the_content(), 50); |
|
111 | 111 | $content = '<p>' . $content . '</p>' . $excerpt_more; |
112 | - echo wp_kses_post( $content ); |
|
112 | + echo wp_kses_post($content); |
|
113 | 113 | } else { |
114 | 114 | the_excerpt(); |
115 | 115 | } |
116 | 116 | ?> |
117 | 117 | </div><!-- .entry-summary --> |
118 | 118 | |
119 | - <?php elseif ( has_post_format( array( 'link' ) ) ) : ?> |
|
119 | + <?php elseif (has_post_format(array('link'))) : ?> |
|
120 | 120 | |
121 | - <?php elseif ( apply_filters( 'lsx_blog_force_content_on_list', false ) ) : ?> |
|
121 | + <?php elseif (apply_filters('lsx_blog_force_content_on_list', false)) : ?> |
|
122 | 122 | |
123 | 123 | <div class="entry-content"> |
124 | 124 | <?php the_content(); ?> |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | <?php |
131 | 131 | the_content(); |
132 | 132 | |
133 | - wp_link_pages( array( |
|
133 | + wp_link_pages(array( |
|
134 | 134 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
135 | 135 | 'after' => '</div></div>', |
136 | 136 | 'link_before' => '<span>', |
137 | 137 | 'link_after' => '</span>', |
138 | - ) ); |
|
138 | + )); |
|
139 | 139 | ?> |
140 | 140 | </div><!-- .entry-content --> |
141 | 141 | |
@@ -151,23 +151,23 @@ discard block |
||
151 | 151 | |
152 | 152 | <?php lsx_content_post_tags(); ?> |
153 | 153 | |
154 | - <?php if ( comments_open() && ! empty( $comments_number ) ) : ?> |
|
154 | + <?php if (comments_open() && ! empty($comments_number)) : ?> |
|
155 | 155 | <div class="post-comments"> |
156 | 156 | <a href="<?php the_permalink(); ?>#comments"> |
157 | 157 | <?php |
158 | - if ( '1' === $comments_number ) { |
|
159 | - echo esc_html_x( 'One Comment', 'content.php', 'lsx' ); |
|
158 | + if ('1' === $comments_number) { |
|
159 | + echo esc_html_x('One Comment', 'content.php', 'lsx'); |
|
160 | 160 | } else { |
161 | 161 | printf( |
162 | 162 | /* Translators: %s: number of comments */ |
163 | - esc_html( _nx( |
|
163 | + esc_html(_nx( |
|
164 | 164 | '%s Comment', |
165 | 165 | '%s Comments', |
166 | 166 | $comments_number, |
167 | 167 | 'content.php', |
168 | 168 | 'lsx' |
169 | - ) ), |
|
170 | - esc_html( number_format_i18n( $comments_number ) ) |
|
169 | + )), |
|
170 | + esc_html(number_format_i18n($comments_number)) |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 | ?> |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | </div> |
178 | 178 | </div> |
179 | 179 | |
180 | - <?php if ( has_post_thumbnail() ) : ?> |
|
180 | + <?php if (has_post_thumbnail()) : ?> |
|
181 | 181 | |
182 | 182 | <div class="entry-image hidden-xs"> |
183 | - <a class="thumbnail" href="<?php the_permalink(); ?>" style="background-image:url(<?php echo esc_url( $image_src ); ?>);"> |
|
184 | - <?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?> |
|
183 | + <a class="thumbnail" href="<?php the_permalink(); ?>" style="background-image:url(<?php echo esc_url($image_src); ?>);"> |
|
184 | + <?php lsx_thumbnail('lsx-thumbnail-single'); ?> |
|
185 | 185 | </a> |
186 | 186 | </div> |
187 | 187 |
@@ -10,34 +10,34 @@ discard block |
||
10 | 10 | <?php lsx_entry_before(); ?> |
11 | 11 | |
12 | 12 | <?php |
13 | - $no_thumb_post_types = array( |
|
14 | - 'audio' => 'audio', |
|
15 | - 'gallery' => 'gallery', |
|
16 | - 'image' => 'image', |
|
17 | - 'link' => 'link', |
|
18 | - 'quote' => 'quote', |
|
19 | - 'video' => 'video', |
|
20 | - ); |
|
21 | - $no_thumb_post_formats = apply_filters( 'lsx_no_thumb_post_formats', $no_thumb_post_types ); |
|
22 | - |
|
23 | - $has_thumb = has_post_thumbnail() && ! has_post_format( $no_thumb_post_formats ); |
|
24 | - |
|
25 | - if ( $has_thumb ) { |
|
26 | - $thumb_class = 'has-thumb'; |
|
27 | - } else { |
|
28 | - $thumb_class = 'no-thumb'; |
|
29 | - } |
|
30 | - |
|
31 | - $blog_layout = apply_filters( 'lsx_blog_layout', 'default' ); |
|
32 | - |
|
33 | - $image_class = ''; |
|
34 | - |
|
35 | - $thumbnail_id = get_post_thumbnail_id( get_the_ID() ); |
|
36 | - $image_arr = wp_get_attachment_image_src( $thumbnail_id, 'lsx-thumbnail-single' ); |
|
37 | - |
|
38 | - if ( is_array( $image_arr ) ) { |
|
39 | - $image_src = $image_arr[0]; |
|
40 | - } |
|
13 | + $no_thumb_post_types = array( |
|
14 | + 'audio' => 'audio', |
|
15 | + 'gallery' => 'gallery', |
|
16 | + 'image' => 'image', |
|
17 | + 'link' => 'link', |
|
18 | + 'quote' => 'quote', |
|
19 | + 'video' => 'video', |
|
20 | + ); |
|
21 | + $no_thumb_post_formats = apply_filters( 'lsx_no_thumb_post_formats', $no_thumb_post_types ); |
|
22 | + |
|
23 | + $has_thumb = has_post_thumbnail() && ! has_post_format( $no_thumb_post_formats ); |
|
24 | + |
|
25 | + if ( $has_thumb ) { |
|
26 | + $thumb_class = 'has-thumb'; |
|
27 | + } else { |
|
28 | + $thumb_class = 'no-thumb'; |
|
29 | + } |
|
30 | + |
|
31 | + $blog_layout = apply_filters( 'lsx_blog_layout', 'default' ); |
|
32 | + |
|
33 | + $image_class = ''; |
|
34 | + |
|
35 | + $thumbnail_id = get_post_thumbnail_id( get_the_ID() ); |
|
36 | + $image_arr = wp_get_attachment_image_src( $thumbnail_id, 'lsx-thumbnail-single' ); |
|
37 | + |
|
38 | + if ( is_array( $image_arr ) ) { |
|
39 | + $image_src = $image_arr[0]; |
|
40 | + } |
|
41 | 41 | ?> |
42 | 42 | |
43 | 43 | <article id="post-<?php the_ID(); ?>" <?php post_class( array( 'lsx-slot', $thumb_class ) ); ?>> |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | <?php endif; ?> |
56 | 56 | |
57 | 57 | <?php |
58 | - $format = get_post_format(); |
|
58 | + $format = get_post_format(); |
|
59 | 59 | |
60 | - if ( false === $format ) { |
|
61 | - $format = 'standard'; |
|
62 | - $show_on_front = get_option( 'show_on_front', 'posts' ); |
|
60 | + if ( false === $format ) { |
|
61 | + $format = 'standard'; |
|
62 | + $show_on_front = get_option( 'show_on_front', 'posts' ); |
|
63 | 63 | |
64 | - if ( 'page' === $show_on_front ) { |
|
65 | - $archive_link = get_permalink( get_option( 'page_for_posts' ) ); |
|
66 | - } else { |
|
67 | - $archive_link = home_url(); |
|
68 | - } |
|
69 | - } else { |
|
70 | - $archive_link = get_post_format_link( $format ); |
|
71 | - } |
|
64 | + if ( 'page' === $show_on_front ) { |
|
65 | + $archive_link = get_permalink( get_option( 'page_for_posts' ) ); |
|
66 | + } else { |
|
67 | + $archive_link = home_url(); |
|
68 | + } |
|
69 | + } else { |
|
70 | + $archive_link = get_post_format_link( $format ); |
|
71 | + } |
|
72 | 72 | |
73 | - $format = lsx_translate_format_to_fontawesome( $format ); |
|
74 | - ?> |
|
73 | + $format = lsx_translate_format_to_fontawesome( $format ); |
|
74 | + ?> |
|
75 | 75 | |
76 | 76 | <h2 class="entry-title"> |
77 | 77 | <?php if ( has_post_thumbnail() ) : ?> |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | |
105 | 105 | <div class="entry-summary"> |
106 | 106 | <?php |
107 | - if ( ! has_excerpt() ) { |
|
108 | - |
|
109 | - $excerpt_more = '<p><a class="moretag" href="' . esc_url( get_permalink() ) . '">' . esc_html__( 'Read More', 'lsx' ) . '</a></p>'; |
|
110 | - $content = wp_trim_words( get_the_content(), 50 ); |
|
111 | - $content = '<p>' . $content . '</p>' . $excerpt_more; |
|
112 | - echo wp_kses_post( $content ); |
|
113 | - } else { |
|
114 | - the_excerpt(); |
|
115 | - } |
|
116 | - ?> |
|
107 | + if ( ! has_excerpt() ) { |
|
108 | + |
|
109 | + $excerpt_more = '<p><a class="moretag" href="' . esc_url( get_permalink() ) . '">' . esc_html__( 'Read More', 'lsx' ) . '</a></p>'; |
|
110 | + $content = wp_trim_words( get_the_content(), 50 ); |
|
111 | + $content = '<p>' . $content . '</p>' . $excerpt_more; |
|
112 | + echo wp_kses_post( $content ); |
|
113 | + } else { |
|
114 | + the_excerpt(); |
|
115 | + } |
|
116 | + ?> |
|
117 | 117 | </div><!-- .entry-summary --> |
118 | 118 | |
119 | 119 | <?php elseif ( has_post_format( array( 'link' ) ) ) : ?> |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | |
129 | 129 | <div class="entry-content"> |
130 | 130 | <?php |
131 | - the_content(); |
|
132 | - |
|
133 | - wp_link_pages( array( |
|
134 | - 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
135 | - 'after' => '</div></div>', |
|
136 | - 'link_before' => '<span>', |
|
137 | - 'link_after' => '</span>', |
|
138 | - ) ); |
|
139 | - ?> |
|
131 | + the_content(); |
|
132 | + |
|
133 | + wp_link_pages( array( |
|
134 | + 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
135 | + 'after' => '</div></div>', |
|
136 | + 'link_before' => '<span>', |
|
137 | + 'link_after' => '</span>', |
|
138 | + ) ); |
|
139 | + ?> |
|
140 | 140 | </div><!-- .entry-content --> |
141 | 141 | |
142 | 142 | <?php endif; ?> |
@@ -155,22 +155,22 @@ discard block |
||
155 | 155 | <div class="post-comments"> |
156 | 156 | <a href="<?php the_permalink(); ?>#comments"> |
157 | 157 | <?php |
158 | - if ( '1' === $comments_number ) { |
|
159 | - echo esc_html_x( 'One Comment', 'content.php', 'lsx' ); |
|
160 | - } else { |
|
161 | - printf( |
|
162 | - /* Translators: %s: number of comments */ |
|
163 | - esc_html( _nx( |
|
164 | - '%s Comment', |
|
165 | - '%s Comments', |
|
166 | - $comments_number, |
|
167 | - 'content.php', |
|
168 | - 'lsx' |
|
169 | - ) ), |
|
170 | - esc_html( number_format_i18n( $comments_number ) ) |
|
171 | - ); |
|
172 | - } |
|
173 | - ?> |
|
158 | + if ( '1' === $comments_number ) { |
|
159 | + echo esc_html_x( 'One Comment', 'content.php', 'lsx' ); |
|
160 | + } else { |
|
161 | + printf( |
|
162 | + /* Translators: %s: number of comments */ |
|
163 | + esc_html( _nx( |
|
164 | + '%s Comment', |
|
165 | + '%s Comments', |
|
166 | + $comments_number, |
|
167 | + 'content.php', |
|
168 | + 'lsx' |
|
169 | + ) ), |
|
170 | + esc_html( number_format_i18n( $comments_number ) ) |
|
171 | + ); |
|
172 | + } |
|
173 | + ?> |
|
174 | 174 | </a> |
175 | 175 | </div> |
176 | 176 | <?php endif ?> |
@@ -76,14 +76,20 @@ discard block |
||
76 | 76 | <h2 class="entry-title"> |
77 | 77 | <?php if ( has_post_thumbnail() ) : ?> |
78 | 78 | <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link has-thumb fa fa-<?php echo esc_attr( $format ); ?>"></a> |
79 | - <?php else : ?> |
|
80 | - <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link fa fa-<?php echo esc_attr( $format ); ?>"></a> |
|
79 | + <?php else { |
|
80 | + : ?> |
|
81 | + <a href="<?php echo esc_url( $archive_link ); |
|
82 | +} |
|
83 | +?>" class="format-link fa fa-<?php echo esc_attr( $format ); ?>"></a> |
|
81 | 84 | <?php endif; ?> |
82 | 85 | |
83 | 86 | <?php if ( has_post_format( array( 'link' ) ) ) : ?> |
84 | 87 | <a href="<?php echo esc_url( lsx_get_my_url() ); ?>" rel="bookmark"><?php the_title(); ?> <span class="fa fa-external-link"></span></a> |
85 | - <?php else : ?> |
|
86 | - <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> |
|
88 | + <?php else { |
|
89 | + : ?> |
|
90 | + <a href="<?php the_permalink(); |
|
91 | +} |
|
92 | +?>" rel="bookmark"><?php the_title(); ?></a> |
|
87 | 93 | <?php endif; ?> |
88 | 94 | |
89 | 95 | <?php if ( is_sticky() ) : ?> |
@@ -124,11 +130,13 @@ discard block |
||
124 | 130 | <?php the_content(); ?> |
125 | 131 | </div><!-- .entry-content --> |
126 | 132 | |
127 | - <?php else : ?> |
|
133 | + <?php else { |
|
134 | + : ?> |
|
128 | 135 | |
129 | 136 | <div class="entry-content"> |
130 | 137 | <?php |
131 | 138 | the_content(); |
139 | +} |
|
132 | 140 | |
133 | 141 | wp_link_pages( array( |
134 | 142 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
@@ -17,31 +17,31 @@ |
||
17 | 17 | <?php |
18 | 18 | the_content(); |
19 | 19 | |
20 | - wp_link_pages( array( |
|
20 | + wp_link_pages(array( |
|
21 | 21 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
22 | 22 | 'after' => '</div></div>', |
23 | 23 | 'link_before' => '<span>', |
24 | 24 | 'link_after' => '</span>', |
25 | - ) ); |
|
25 | + )); |
|
26 | 26 | ?> |
27 | 27 | </div><!-- .entry-content --> |
28 | 28 | |
29 | 29 | <footer class="footer-meta clearfix"> |
30 | - <?php if ( has_tag() || class_exists( 'LSX_Sharing' ) || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) : ?> |
|
30 | + <?php if (has_tag() || class_exists('LSX_Sharing') || (function_exists('sharing_display') || class_exists('Jetpack_Likes'))) : ?> |
|
31 | 31 | <div class="post-tags-wrapper"> |
32 | 32 | <?php lsx_content_post_tags(); ?> |
33 | 33 | |
34 | 34 | <?php |
35 | - if ( class_exists( 'LSX_Sharing' ) ) { |
|
35 | + if (class_exists('LSX_Sharing')) { |
|
36 | 36 | lsx_content_sharing(); |
37 | 37 | } else { |
38 | - if ( function_exists( 'sharing_display' ) ) { |
|
39 | - sharing_display( '', true ); |
|
38 | + if (function_exists('sharing_display')) { |
|
39 | + sharing_display('', true); |
|
40 | 40 | } |
41 | 41 | |
42 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
42 | + if (class_exists('Jetpack_Likes')) { |
|
43 | 43 | $custom_likes = new Jetpack_Likes(); |
44 | - echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
44 | + echo wp_kses_post($custom_likes->post_likes('')); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | ?> |
@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | |
16 | 16 | <div class="entry-content"> |
17 | 17 | <?php |
18 | - the_content(); |
|
19 | - |
|
20 | - wp_link_pages( array( |
|
21 | - 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
22 | - 'after' => '</div></div>', |
|
23 | - 'link_before' => '<span>', |
|
24 | - 'link_after' => '</span>', |
|
25 | - ) ); |
|
26 | - ?> |
|
18 | + the_content(); |
|
19 | + |
|
20 | + wp_link_pages( array( |
|
21 | + 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
|
22 | + 'after' => '</div></div>', |
|
23 | + 'link_before' => '<span>', |
|
24 | + 'link_after' => '</span>', |
|
25 | + ) ); |
|
26 | + ?> |
|
27 | 27 | </div><!-- .entry-content --> |
28 | 28 | |
29 | 29 | <footer class="footer-meta clearfix"> |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | <?php lsx_content_post_tags(); ?> |
33 | 33 | |
34 | 34 | <?php |
35 | - if ( class_exists( 'LSX_Sharing' ) ) { |
|
36 | - lsx_content_sharing(); |
|
37 | - } else { |
|
38 | - if ( function_exists( 'sharing_display' ) ) { |
|
39 | - sharing_display( '', true ); |
|
40 | - } |
|
41 | - |
|
42 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
43 | - $custom_likes = new Jetpack_Likes(); |
|
44 | - echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
45 | - } |
|
46 | - } |
|
47 | - ?> |
|
35 | + if ( class_exists( 'LSX_Sharing' ) ) { |
|
36 | + lsx_content_sharing(); |
|
37 | + } else { |
|
38 | + if ( function_exists( 'sharing_display' ) ) { |
|
39 | + sharing_display( '', true ); |
|
40 | + } |
|
41 | + |
|
42 | + if ( class_exists( 'Jetpack_Likes' ) ) { |
|
43 | + $custom_likes = new Jetpack_Likes(); |
|
44 | + echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
45 | + } |
|
46 | + } |
|
47 | + ?> |
|
48 | 48 | <?php endif ?> |
49 | 49 | </footer><!-- .footer-meta --> |
50 | 50 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
12 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
13 | 13 | |
14 | 14 | <?php lsx_content_before(); ?> |
15 | 15 | |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php lsx_content_top(); ?> |
19 | 19 | |
20 | - <?php if ( have_posts() ) : ?> |
|
20 | + <?php if (have_posts()) : ?> |
|
21 | 21 | |
22 | - <div class="post-wrapper <?php echo esc_attr( lsx_post_wrapper_class() ); ?>"> |
|
22 | + <div class="post-wrapper <?php echo esc_attr(lsx_post_wrapper_class()); ?>"> |
|
23 | 23 | <?php |
24 | - while ( have_posts() ) : |
|
24 | + while (have_posts()) : |
|
25 | 25 | the_post(); |
26 | 26 | lsx_get_template_part(); |
27 | 27 | endwhile; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | <?php else : ?> |
34 | 34 | |
35 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
35 | + <?php get_template_part('partials/content', 'none'); ?> |
|
36 | 36 | |
37 | 37 | <?php endif; ?> |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | <?php lsx_content_wrap_after(); ?> |
48 | 48 | |
49 | -<?php get_sidebar( 'sidebar' ); ?> |
|
49 | +<?php get_sidebar('sidebar'); ?> |
|
50 | 50 | |
51 | 51 | <?php |
52 | 52 | get_footer(); |
@@ -21,11 +21,11 @@ |
||
21 | 21 | |
22 | 22 | <div class="post-wrapper <?php echo esc_attr( lsx_post_wrapper_class() ); ?>"> |
23 | 23 | <?php |
24 | - while ( have_posts() ) : |
|
25 | - the_post(); |
|
26 | - lsx_get_template_part(); |
|
27 | - endwhile; |
|
28 | - ?> |
|
24 | + while ( have_posts() ) : |
|
25 | + the_post(); |
|
26 | + lsx_get_template_part(); |
|
27 | + endwhile; |
|
28 | + ?> |
|
29 | 29 | </div> |
30 | 30 | |
31 | 31 | <?php lsx_paging_nav(); ?> |
@@ -30,9 +30,12 @@ |
||
30 | 30 | |
31 | 31 | <?php lsx_paging_nav(); ?> |
32 | 32 | |
33 | - <?php else : ?> |
|
33 | + <?php else { |
|
34 | + : ?> |
|
34 | 35 | |
35 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
36 | + <?php get_template_part( 'partials/content', 'none' ); |
|
37 | +} |
|
38 | +?> |
|
36 | 39 | |
37 | 40 | <?php endif; ?> |
38 | 41 |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function add_gutenberg_compatible_body_class( $classes ) { |
28 | 28 | // if ( ! is_home() && ! is_front_page() ). |
29 | - if ( is_page() || is_page_template() || is_single() ) |
|
30 | - $classes[] = 'gutenberg-compatible-template'; |
|
29 | + if ( is_page() || is_page_template() || is_single() ) { |
|
30 | + $classes[] = 'gutenberg-compatible-template'; |
|
31 | + } |
|
31 | 32 | |
32 | 33 | // Add a class if the page is using the Content and Media block. |
33 | 34 | $post = get_post(); |
@@ -48,8 +49,9 @@ discard block |
||
48 | 49 | |
49 | 50 | // Add custom class for templates that are using the Gutenberg editor. |
50 | 51 | add_action('body_class', function( $classes ) { |
51 | - if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ( is_singular( 'post' ) || is_page() ) ) ) |
|
52 | - $classes[] = 'using-gutenberg'; |
|
52 | + if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ( is_singular( 'post' ) || is_page() ) ) ) { |
|
53 | + $classes[] = 'using-gutenberg'; |
|
54 | + } |
|
53 | 55 | return $classes; |
54 | 56 | }); |
55 | 57 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage Gutenberg |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | * Enqueue Admin styles on admin area |
15 | 15 | */ |
16 | 16 | function load_gutenberg_admin_style() { |
17 | - wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/assets/css/admin/gutenberg-admin.css', false, '1.0.0' ); |
|
17 | + wp_enqueue_style('admin_css', get_template_directory_uri() . '/assets/css/admin/gutenberg-admin.css', false, '1.0.0'); |
|
18 | 18 | } |
19 | -add_action( 'admin_enqueue_scripts', 'load_gutenberg_admin_style' ); |
|
19 | +add_action('admin_enqueue_scripts', 'load_gutenberg_admin_style'); |
|
20 | 20 | |
21 | 21 | // Gutenberg Compatibility. |
22 | 22 | require get_template_directory() . '/lib/theme-support.php'; |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * Add custom class for Gutenberg Compatible template |
26 | 26 | */ |
27 | -function add_gutenberg_compatible_body_class( $classes ) { |
|
27 | +function add_gutenberg_compatible_body_class($classes) { |
|
28 | 28 | // if ( ! is_home() && ! is_front_page() ). |
29 | - if ( is_page() || is_page_template() || is_single() ) |
|
29 | + if (is_page() || is_page_template() || is_single()) |
|
30 | 30 | $classes[] = 'gutenberg-compatible-template'; |
31 | 31 | |
32 | 32 | // Add a class if the page is using the Content and Media block. |
33 | 33 | $post = get_post(); |
34 | - if ( function_exists( 'has_blocks' ) && isset( $post->post_content ) && has_blocks( $post->post_content ) && ( ! is_search() ) && ( ! is_archive() ) ) { |
|
35 | - $blocks = parse_blocks( $post->post_content ); |
|
34 | + if (function_exists('has_blocks') && isset($post->post_content) && has_blocks($post->post_content) && ( ! is_search()) && ( ! is_archive())) { |
|
35 | + $blocks = parse_blocks($post->post_content); |
|
36 | 36 | |
37 | - if ( 'core/media-text' === $blocks[0]['blockName'] ) { |
|
37 | + if ('core/media-text' === $blocks[0]['blockName']) { |
|
38 | 38 | $classes[] = 'has-block-media-text'; |
39 | 39 | } |
40 | - if ( 'core/cover' === $blocks[0]['blockName'] ) { |
|
40 | + if ('core/cover' === $blocks[0]['blockName']) { |
|
41 | 41 | $classes[] = 'has-block-cover'; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | return $classes; |
45 | 45 | } |
46 | 46 | |
47 | -add_filter( 'body_class', __NAMESPACE__ . '\add_gutenberg_compatible_body_class' ); |
|
47 | +add_filter('body_class', __NAMESPACE__ . '\add_gutenberg_compatible_body_class'); |
|
48 | 48 | |
49 | 49 | // Add custom class for templates that are using the Gutenberg editor. |
50 | -add_action('body_class', function( $classes ) { |
|
51 | - if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ( is_singular( 'post' ) || is_page() ) ) ) |
|
50 | +add_action('body_class', function($classes) { |
|
51 | + if (function_exists('has_blocks') && has_blocks(get_the_ID()) && ((is_singular('post') || is_page()))) |
|
52 | 52 | $classes[] = 'using-gutenberg'; |
53 | 53 | return $classes; |
54 | 54 | }); |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | * @return void |
60 | 60 | */ |
61 | 61 | function remove_lsx_page_banner_when_using_blocks() { |
62 | - if ( function_exists( 'has_blocks' ) && ( ! class_exists( 'LSX_Banners' ) ) ) { |
|
63 | - add_filter( 'lsx_page_banner_disable', '__return_true' ); |
|
62 | + if (function_exists('has_blocks') && ( ! class_exists('LSX_Banners'))) { |
|
63 | + add_filter('lsx_page_banner_disable', '__return_true'); |
|
64 | 64 | } |
65 | 65 | } |
66 | -add_filter( 'init', 'remove_lsx_page_banner_when_using_blocks' ); |
|
66 | +add_filter('init', 'remove_lsx_page_banner_when_using_blocks'); |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
10 | - exit; |
|
10 | + exit; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Enqueue Admin styles on admin area |
15 | 15 | */ |
16 | 16 | function load_gutenberg_admin_style() { |
17 | - wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/assets/css/admin/gutenberg-admin.css', false, '1.0.0' ); |
|
17 | + wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/assets/css/admin/gutenberg-admin.css', false, '1.0.0' ); |
|
18 | 18 | } |
19 | 19 | add_action( 'admin_enqueue_scripts', 'load_gutenberg_admin_style' ); |
20 | 20 | |
@@ -25,32 +25,32 @@ discard block |
||
25 | 25 | * Add custom class for Gutenberg Compatible template |
26 | 26 | */ |
27 | 27 | function add_gutenberg_compatible_body_class( $classes ) { |
28 | - // if ( ! is_home() && ! is_front_page() ). |
|
29 | - if ( is_page() || is_page_template() || is_single() ) |
|
30 | - $classes[] = 'gutenberg-compatible-template'; |
|
28 | + // if ( ! is_home() && ! is_front_page() ). |
|
29 | + if ( is_page() || is_page_template() || is_single() ) |
|
30 | + $classes[] = 'gutenberg-compatible-template'; |
|
31 | 31 | |
32 | - // Add a class if the page is using the Content and Media block. |
|
33 | - $post = get_post(); |
|
34 | - if ( function_exists( 'has_blocks' ) && isset( $post->post_content ) && has_blocks( $post->post_content ) && ( ! is_search() ) && ( ! is_archive() ) ) { |
|
35 | - $blocks = parse_blocks( $post->post_content ); |
|
32 | + // Add a class if the page is using the Content and Media block. |
|
33 | + $post = get_post(); |
|
34 | + if ( function_exists( 'has_blocks' ) && isset( $post->post_content ) && has_blocks( $post->post_content ) && ( ! is_search() ) && ( ! is_archive() ) ) { |
|
35 | + $blocks = parse_blocks( $post->post_content ); |
|
36 | 36 | |
37 | - if ( 'core/media-text' === $blocks[0]['blockName'] ) { |
|
38 | - $classes[] = 'has-block-media-text'; |
|
39 | - } |
|
40 | - if ( 'core/cover' === $blocks[0]['blockName'] ) { |
|
41 | - $classes[] = 'has-block-cover'; |
|
42 | - } |
|
43 | - } |
|
44 | - return $classes; |
|
37 | + if ( 'core/media-text' === $blocks[0]['blockName'] ) { |
|
38 | + $classes[] = 'has-block-media-text'; |
|
39 | + } |
|
40 | + if ( 'core/cover' === $blocks[0]['blockName'] ) { |
|
41 | + $classes[] = 'has-block-cover'; |
|
42 | + } |
|
43 | + } |
|
44 | + return $classes; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | add_filter( 'body_class', __NAMESPACE__ . '\add_gutenberg_compatible_body_class' ); |
48 | 48 | |
49 | 49 | // Add custom class for templates that are using the Gutenberg editor. |
50 | 50 | add_action('body_class', function( $classes ) { |
51 | - if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ( is_singular( 'post' ) || is_page() ) ) ) |
|
52 | - $classes[] = 'using-gutenberg'; |
|
53 | - return $classes; |
|
51 | + if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ( is_singular( 'post' ) || is_page() ) ) ) |
|
52 | + $classes[] = 'using-gutenberg'; |
|
53 | + return $classes; |
|
54 | 54 | }); |
55 | 55 | |
56 | 56 | /** |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | * @return void |
60 | 60 | */ |
61 | 61 | function remove_lsx_page_banner_when_using_blocks() { |
62 | - if ( function_exists( 'has_blocks' ) && ( ! class_exists( 'LSX_Banners' ) ) ) { |
|
63 | - add_filter( 'lsx_page_banner_disable', '__return_true' ); |
|
64 | - } |
|
62 | + if ( function_exists( 'has_blocks' ) && ( ! class_exists( 'LSX_Banners' ) ) ) { |
|
63 | + add_filter( 'lsx_page_banner_disable', '__return_true' ); |
|
64 | + } |
|
65 | 65 | } |
66 | 66 | add_filter( 'init', 'remove_lsx_page_banner_when_using_blocks' ); |