@@ -9,168 +9,168 @@ |
||
9 | 9 | |
10 | 10 | class Settings { |
11 | 11 | |
12 | - /** |
|
13 | - * Holds class instance |
|
14 | - * |
|
15 | - * @since 1.0.0 |
|
16 | - * |
|
17 | - * @var object \lsx_projects\classes\admin\Settings() |
|
18 | - */ |
|
19 | - protected static $instance = null; |
|
20 | - |
|
21 | - /** |
|
22 | - * Option key, and option page slug |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $screen_id = 'lsx_projects_settings'; |
|
27 | - |
|
28 | - /** |
|
29 | - * Contructor |
|
30 | - */ |
|
31 | - public function __construct() { |
|
32 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
33 | - add_action( 'lsx_projects_settings_page', array( $this, 'general_settings' ), 1, 1 ); |
|
34 | - add_action( 'lsx_projects_settings_page', array( $this, 'contact_modal_settings' ), 1, 1 ); |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * Return an instance of this class. |
|
39 | - * |
|
40 | - * @since 1.0.0 |
|
41 | - * |
|
42 | - * @return object Settings() A single instance of this class. |
|
43 | - */ |
|
44 | - public static function get_instance() { |
|
45 | - // If the single instance hasn't been set, set it now. |
|
46 | - if ( null === self::$instance ) { |
|
47 | - self::$instance = new self(); |
|
48 | - } |
|
49 | - return self::$instance; |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * Hook in and register a submenu options page for the Page post-type menu. |
|
54 | - */ |
|
55 | - public function register_settings_page() { |
|
56 | - $cmb = new_cmb2_box( |
|
57 | - array( |
|
58 | - 'id' => $this->screen_id, |
|
59 | - 'title' => esc_html__( 'Settings', 'lsx-projects' ), |
|
60 | - 'object_types' => array( 'options-page' ), |
|
61 | - 'option_key' => 'lsx_projects_options', // The option key and admin menu page slug. |
|
62 | - 'parent_slug' => 'edit.php?post_type=project', // Make options page a submenu item of the themes menu. |
|
63 | - 'capability' => 'manage_options', // Cap required to view options-page. |
|
64 | - ) |
|
65 | - ); |
|
66 | - do_action( 'lsx_projects_settings_page', $cmb ); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Registers the general settings. |
|
71 | - * |
|
72 | - * @param object $cmb new_cmb2_box(). |
|
73 | - * @return void |
|
74 | - */ |
|
75 | - public function general_settings( $cmb ) { |
|
76 | - $cmb->add_field( |
|
77 | - array( |
|
78 | - 'id' => 'settings_general_title', |
|
79 | - 'type' => 'title', |
|
80 | - 'name' => __( 'General', 'lsx-projects' ), |
|
81 | - 'default' => __( 'General', 'lsx-projects' ), |
|
82 | - ) |
|
83 | - ); |
|
84 | - $cmb->add_field( |
|
85 | - array( |
|
86 | - 'name' => __( 'Disable Single Posts', 'lsx-projects' ), |
|
87 | - 'id' => 'projects_disable_single', |
|
88 | - 'type' => 'checkbox', |
|
89 | - 'value' => 1, |
|
90 | - 'default' => 0, |
|
91 | - 'description' => __( 'Disable Single Posts.', 'lsx-projects' ), |
|
92 | - ) |
|
93 | - ); |
|
94 | - |
|
95 | - $cmb->add_field( |
|
96 | - array( |
|
97 | - 'name' => 'Placeholder', |
|
98 | - 'desc' => __( 'Choose Image.', 'lsx-projects' ), |
|
99 | - 'id' => 'projects_placeholder', |
|
100 | - 'type' => 'file', |
|
101 | - 'options' => array( |
|
102 | - 'url' => false, // Hide the text input for the url. |
|
103 | - ), |
|
104 | - 'text' => array( |
|
105 | - 'add_upload_file_text' => 'Choose Image', |
|
106 | - ), |
|
107 | - ) |
|
108 | - ); |
|
109 | - |
|
110 | - $cmb->add_field( |
|
111 | - array( |
|
112 | - 'id' => 'settings_general_closing', |
|
113 | - 'type' => 'tab_closing', |
|
114 | - ) |
|
115 | - ); |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Registers the Contact modal settings. |
|
120 | - * |
|
121 | - * @param object $cmb new_cmb2_box(). |
|
122 | - * @return void |
|
123 | - */ |
|
124 | - public function contact_modal_settings( $cmb ) { |
|
125 | - $cmb->add_field( |
|
126 | - array( |
|
127 | - 'id' => 'settings_contact_modal_title', |
|
128 | - 'type' => 'title', |
|
129 | - 'name' => __( 'Contact modal', 'lsx-projects' ), |
|
130 | - 'description' => __( 'Displays contact modal on project single if there is a linked Caldera or WPform.', 'lsx-projects' ), |
|
131 | - ) |
|
132 | - ); |
|
133 | - $cmb->add_field( |
|
134 | - array( |
|
135 | - 'name' => __( 'Enable contact modal', 'lsx-projects' ), |
|
136 | - 'id' => 'projects_modal_enable', |
|
137 | - 'type' => 'checkbox', |
|
138 | - 'value' => 1, |
|
139 | - 'default' => 0, |
|
140 | - 'description' => __( 'Displays contact modal on project single.', 'lsx-projects' ), |
|
141 | - ) |
|
142 | - ); |
|
143 | - |
|
144 | - $cmb->add_field( |
|
145 | - array( |
|
146 | - 'name' => __( 'Button label', 'lsx-projects' ), |
|
147 | - 'id' => 'projects_modal_cta_label', |
|
148 | - 'type' => 'text', |
|
149 | - ) |
|
150 | - ); |
|
151 | - |
|
152 | - $cmb->add_field( |
|
153 | - array( |
|
154 | - 'name' => __( 'Caldera Form ID (if enabled)', 'lsx-projects' ), |
|
155 | - 'id' => 'projects_modal_form_id', |
|
156 | - 'type' => 'text', |
|
157 | - ) |
|
158 | - ); |
|
159 | - |
|
160 | - $cmb->add_field( |
|
161 | - array( |
|
162 | - 'name' => __( 'WPForm ID (if enabled)', 'lsx-projects' ), |
|
163 | - 'id' => 'projects_wpform_modal_form_id', |
|
164 | - 'type' => 'text', |
|
165 | - ) |
|
166 | - ); |
|
167 | - |
|
168 | - $cmb->add_field( |
|
169 | - array( |
|
170 | - 'id' => 'settings_contact_modal_closing', |
|
171 | - 'type' => 'tab_closing', |
|
172 | - ) |
|
173 | - ); |
|
174 | - } |
|
12 | + /** |
|
13 | + * Holds class instance |
|
14 | + * |
|
15 | + * @since 1.0.0 |
|
16 | + * |
|
17 | + * @var object \lsx_projects\classes\admin\Settings() |
|
18 | + */ |
|
19 | + protected static $instance = null; |
|
20 | + |
|
21 | + /** |
|
22 | + * Option key, and option page slug |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $screen_id = 'lsx_projects_settings'; |
|
27 | + |
|
28 | + /** |
|
29 | + * Contructor |
|
30 | + */ |
|
31 | + public function __construct() { |
|
32 | + add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
33 | + add_action( 'lsx_projects_settings_page', array( $this, 'general_settings' ), 1, 1 ); |
|
34 | + add_action( 'lsx_projects_settings_page', array( $this, 'contact_modal_settings' ), 1, 1 ); |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * Return an instance of this class. |
|
39 | + * |
|
40 | + * @since 1.0.0 |
|
41 | + * |
|
42 | + * @return object Settings() A single instance of this class. |
|
43 | + */ |
|
44 | + public static function get_instance() { |
|
45 | + // If the single instance hasn't been set, set it now. |
|
46 | + if ( null === self::$instance ) { |
|
47 | + self::$instance = new self(); |
|
48 | + } |
|
49 | + return self::$instance; |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * Hook in and register a submenu options page for the Page post-type menu. |
|
54 | + */ |
|
55 | + public function register_settings_page() { |
|
56 | + $cmb = new_cmb2_box( |
|
57 | + array( |
|
58 | + 'id' => $this->screen_id, |
|
59 | + 'title' => esc_html__( 'Settings', 'lsx-projects' ), |
|
60 | + 'object_types' => array( 'options-page' ), |
|
61 | + 'option_key' => 'lsx_projects_options', // The option key and admin menu page slug. |
|
62 | + 'parent_slug' => 'edit.php?post_type=project', // Make options page a submenu item of the themes menu. |
|
63 | + 'capability' => 'manage_options', // Cap required to view options-page. |
|
64 | + ) |
|
65 | + ); |
|
66 | + do_action( 'lsx_projects_settings_page', $cmb ); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Registers the general settings. |
|
71 | + * |
|
72 | + * @param object $cmb new_cmb2_box(). |
|
73 | + * @return void |
|
74 | + */ |
|
75 | + public function general_settings( $cmb ) { |
|
76 | + $cmb->add_field( |
|
77 | + array( |
|
78 | + 'id' => 'settings_general_title', |
|
79 | + 'type' => 'title', |
|
80 | + 'name' => __( 'General', 'lsx-projects' ), |
|
81 | + 'default' => __( 'General', 'lsx-projects' ), |
|
82 | + ) |
|
83 | + ); |
|
84 | + $cmb->add_field( |
|
85 | + array( |
|
86 | + 'name' => __( 'Disable Single Posts', 'lsx-projects' ), |
|
87 | + 'id' => 'projects_disable_single', |
|
88 | + 'type' => 'checkbox', |
|
89 | + 'value' => 1, |
|
90 | + 'default' => 0, |
|
91 | + 'description' => __( 'Disable Single Posts.', 'lsx-projects' ), |
|
92 | + ) |
|
93 | + ); |
|
94 | + |
|
95 | + $cmb->add_field( |
|
96 | + array( |
|
97 | + 'name' => 'Placeholder', |
|
98 | + 'desc' => __( 'Choose Image.', 'lsx-projects' ), |
|
99 | + 'id' => 'projects_placeholder', |
|
100 | + 'type' => 'file', |
|
101 | + 'options' => array( |
|
102 | + 'url' => false, // Hide the text input for the url. |
|
103 | + ), |
|
104 | + 'text' => array( |
|
105 | + 'add_upload_file_text' => 'Choose Image', |
|
106 | + ), |
|
107 | + ) |
|
108 | + ); |
|
109 | + |
|
110 | + $cmb->add_field( |
|
111 | + array( |
|
112 | + 'id' => 'settings_general_closing', |
|
113 | + 'type' => 'tab_closing', |
|
114 | + ) |
|
115 | + ); |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * Registers the Contact modal settings. |
|
120 | + * |
|
121 | + * @param object $cmb new_cmb2_box(). |
|
122 | + * @return void |
|
123 | + */ |
|
124 | + public function contact_modal_settings( $cmb ) { |
|
125 | + $cmb->add_field( |
|
126 | + array( |
|
127 | + 'id' => 'settings_contact_modal_title', |
|
128 | + 'type' => 'title', |
|
129 | + 'name' => __( 'Contact modal', 'lsx-projects' ), |
|
130 | + 'description' => __( 'Displays contact modal on project single if there is a linked Caldera or WPform.', 'lsx-projects' ), |
|
131 | + ) |
|
132 | + ); |
|
133 | + $cmb->add_field( |
|
134 | + array( |
|
135 | + 'name' => __( 'Enable contact modal', 'lsx-projects' ), |
|
136 | + 'id' => 'projects_modal_enable', |
|
137 | + 'type' => 'checkbox', |
|
138 | + 'value' => 1, |
|
139 | + 'default' => 0, |
|
140 | + 'description' => __( 'Displays contact modal on project single.', 'lsx-projects' ), |
|
141 | + ) |
|
142 | + ); |
|
143 | + |
|
144 | + $cmb->add_field( |
|
145 | + array( |
|
146 | + 'name' => __( 'Button label', 'lsx-projects' ), |
|
147 | + 'id' => 'projects_modal_cta_label', |
|
148 | + 'type' => 'text', |
|
149 | + ) |
|
150 | + ); |
|
151 | + |
|
152 | + $cmb->add_field( |
|
153 | + array( |
|
154 | + 'name' => __( 'Caldera Form ID (if enabled)', 'lsx-projects' ), |
|
155 | + 'id' => 'projects_modal_form_id', |
|
156 | + 'type' => 'text', |
|
157 | + ) |
|
158 | + ); |
|
159 | + |
|
160 | + $cmb->add_field( |
|
161 | + array( |
|
162 | + 'name' => __( 'WPForm ID (if enabled)', 'lsx-projects' ), |
|
163 | + 'id' => 'projects_wpform_modal_form_id', |
|
164 | + 'type' => 'text', |
|
165 | + ) |
|
166 | + ); |
|
167 | + |
|
168 | + $cmb->add_field( |
|
169 | + array( |
|
170 | + 'id' => 'settings_contact_modal_closing', |
|
171 | + 'type' => 'tab_closing', |
|
172 | + ) |
|
173 | + ); |
|
174 | + } |
|
175 | 175 | |
176 | 176 | } |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * Contructor |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
33 | - add_action( 'lsx_projects_settings_page', array( $this, 'general_settings' ), 1, 1 ); |
|
34 | - add_action( 'lsx_projects_settings_page', array( $this, 'contact_modal_settings' ), 1, 1 ); |
|
32 | + add_action('cmb2_admin_init', array($this, 'register_settings_page')); |
|
33 | + add_action('lsx_projects_settings_page', array($this, 'general_settings'), 1, 1); |
|
34 | + add_action('lsx_projects_settings_page', array($this, 'contact_modal_settings'), 1, 1); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function get_instance() { |
45 | 45 | // If the single instance hasn't been set, set it now. |
46 | - if ( null === self::$instance ) { |
|
46 | + if (null === self::$instance) { |
|
47 | 47 | self::$instance = new self(); |
48 | 48 | } |
49 | 49 | return self::$instance; |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | $cmb = new_cmb2_box( |
57 | 57 | array( |
58 | 58 | 'id' => $this->screen_id, |
59 | - 'title' => esc_html__( 'Settings', 'lsx-projects' ), |
|
60 | - 'object_types' => array( 'options-page' ), |
|
59 | + 'title' => esc_html__('Settings', 'lsx-projects'), |
|
60 | + 'object_types' => array('options-page'), |
|
61 | 61 | 'option_key' => 'lsx_projects_options', // The option key and admin menu page slug. |
62 | 62 | 'parent_slug' => 'edit.php?post_type=project', // Make options page a submenu item of the themes menu. |
63 | 63 | 'capability' => 'manage_options', // Cap required to view options-page. |
64 | 64 | ) |
65 | 65 | ); |
66 | - do_action( 'lsx_projects_settings_page', $cmb ); |
|
66 | + do_action('lsx_projects_settings_page', $cmb); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -72,30 +72,30 @@ discard block |
||
72 | 72 | * @param object $cmb new_cmb2_box(). |
73 | 73 | * @return void |
74 | 74 | */ |
75 | - public function general_settings( $cmb ) { |
|
75 | + public function general_settings($cmb) { |
|
76 | 76 | $cmb->add_field( |
77 | 77 | array( |
78 | 78 | 'id' => 'settings_general_title', |
79 | 79 | 'type' => 'title', |
80 | - 'name' => __( 'General', 'lsx-projects' ), |
|
81 | - 'default' => __( 'General', 'lsx-projects' ), |
|
80 | + 'name' => __('General', 'lsx-projects'), |
|
81 | + 'default' => __('General', 'lsx-projects'), |
|
82 | 82 | ) |
83 | 83 | ); |
84 | 84 | $cmb->add_field( |
85 | 85 | array( |
86 | - 'name' => __( 'Disable Single Posts', 'lsx-projects' ), |
|
86 | + 'name' => __('Disable Single Posts', 'lsx-projects'), |
|
87 | 87 | 'id' => 'projects_disable_single', |
88 | 88 | 'type' => 'checkbox', |
89 | 89 | 'value' => 1, |
90 | 90 | 'default' => 0, |
91 | - 'description' => __( 'Disable Single Posts.', 'lsx-projects' ), |
|
91 | + 'description' => __('Disable Single Posts.', 'lsx-projects'), |
|
92 | 92 | ) |
93 | 93 | ); |
94 | 94 | |
95 | 95 | $cmb->add_field( |
96 | 96 | array( |
97 | 97 | 'name' => 'Placeholder', |
98 | - 'desc' => __( 'Choose Image.', 'lsx-projects' ), |
|
98 | + 'desc' => __('Choose Image.', 'lsx-projects'), |
|
99 | 99 | 'id' => 'projects_placeholder', |
100 | 100 | 'type' => 'file', |
101 | 101 | 'options' => array( |
@@ -121,29 +121,29 @@ discard block |
||
121 | 121 | * @param object $cmb new_cmb2_box(). |
122 | 122 | * @return void |
123 | 123 | */ |
124 | - public function contact_modal_settings( $cmb ) { |
|
124 | + public function contact_modal_settings($cmb) { |
|
125 | 125 | $cmb->add_field( |
126 | 126 | array( |
127 | 127 | 'id' => 'settings_contact_modal_title', |
128 | 128 | 'type' => 'title', |
129 | - 'name' => __( 'Contact modal', 'lsx-projects' ), |
|
130 | - 'description' => __( 'Displays contact modal on project single if there is a linked Caldera or WPform.', 'lsx-projects' ), |
|
129 | + 'name' => __('Contact modal', 'lsx-projects'), |
|
130 | + 'description' => __('Displays contact modal on project single if there is a linked Caldera or WPform.', 'lsx-projects'), |
|
131 | 131 | ) |
132 | 132 | ); |
133 | 133 | $cmb->add_field( |
134 | 134 | array( |
135 | - 'name' => __( 'Enable contact modal', 'lsx-projects' ), |
|
135 | + 'name' => __('Enable contact modal', 'lsx-projects'), |
|
136 | 136 | 'id' => 'projects_modal_enable', |
137 | 137 | 'type' => 'checkbox', |
138 | 138 | 'value' => 1, |
139 | 139 | 'default' => 0, |
140 | - 'description' => __( 'Displays contact modal on project single.', 'lsx-projects' ), |
|
140 | + 'description' => __('Displays contact modal on project single.', 'lsx-projects'), |
|
141 | 141 | ) |
142 | 142 | ); |
143 | 143 | |
144 | 144 | $cmb->add_field( |
145 | 145 | array( |
146 | - 'name' => __( 'Button label', 'lsx-projects' ), |
|
146 | + 'name' => __('Button label', 'lsx-projects'), |
|
147 | 147 | 'id' => 'projects_modal_cta_label', |
148 | 148 | 'type' => 'text', |
149 | 149 | ) |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | $cmb->add_field( |
153 | 153 | array( |
154 | - 'name' => __( 'Caldera Form ID (if enabled)', 'lsx-projects' ), |
|
154 | + 'name' => __('Caldera Form ID (if enabled)', 'lsx-projects'), |
|
155 | 155 | 'id' => 'projects_modal_form_id', |
156 | 156 | 'type' => 'text', |
157 | 157 | ) |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | $cmb->add_field( |
161 | 161 | array( |
162 | - 'name' => __( 'WPForm ID (if enabled)', 'lsx-projects' ), |
|
162 | + 'name' => __('WPForm ID (if enabled)', 'lsx-projects'), |
|
163 | 163 | 'id' => 'projects_wpform_modal_form_id', |
164 | 164 | 'type' => 'text', |
165 | 165 | ) |
@@ -10,115 +10,115 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class LSX_Projects_Frontend { |
12 | 12 | |
13 | - public function __construct() { |
|
14 | - $this->options = projects_get_options(); |
|
15 | - |
|
16 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 ); |
|
17 | - add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 ); |
|
18 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
19 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
20 | - |
|
21 | - if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
22 | - add_action( 'template_redirect', array( $this, 'disable_single' ) ); |
|
23 | - } |
|
24 | - |
|
25 | - if ( is_admin() ) { |
|
26 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
27 | - } |
|
28 | - |
|
29 | - add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 ); |
|
30 | - |
|
31 | - add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) ); |
|
32 | - add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) ); |
|
33 | - add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) ); |
|
34 | - |
|
35 | - add_filter( 'pre_get_posts', array( $this, 'posts_per_page' ) ); |
|
36 | - add_action( 'wp_footer', array( $this, 'add_form_modal' ) ); |
|
37 | - } |
|
38 | - |
|
39 | - public function enqueue_scripts() { |
|
40 | - $has_slick = wp_script_is( 'slick', 'queue' ); |
|
41 | - |
|
42 | - if ( ! $has_slick ) { |
|
43 | - wp_enqueue_style( 'slick', LSX_PROJECTS_URL . 'assets/css/vendor/slick.css', array(), LSX_PROJECTS_VER, null ); |
|
44 | - wp_enqueue_script( 'slick', LSX_PROJECTS_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
45 | - } |
|
46 | - |
|
47 | - $has_scrolltofixed = wp_script_is( 'scrolltofixed', 'queue' ); |
|
48 | - |
|
49 | - if ( ! $has_scrolltofixed ) { |
|
50 | - wp_enqueue_script( 'scrolltofixed', LSX_PROJECTS_URL . 'assets/js/vendor/jquery-scrolltofixed-min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
51 | - } |
|
52 | - |
|
53 | - $has_isotope = wp_script_is( 'isotope', 'queue' ); |
|
54 | - |
|
55 | - if ( ! $has_isotope ) { |
|
56 | - wp_enqueue_script( 'isotope', LSX_PROJECTS_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
57 | - } |
|
58 | - |
|
59 | - wp_enqueue_script( 'lsx-projects', LSX_PROJECTS_URL . 'assets/js/lsx-projects.min.js', array( 'jquery', 'slick', 'scrolltofixed', 'isotope' ), LSX_PROJECTS_VER, true ); |
|
60 | - |
|
61 | - $params = apply_filters( 'lsx_projects_js_params', array( |
|
62 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
63 | - )); |
|
64 | - |
|
65 | - wp_localize_script( 'lsx-projects', 'lsx_customizer_params', $params ); |
|
66 | - |
|
67 | - wp_enqueue_style( 'lsx-projects', LSX_PROJECTS_URL . 'assets/css/lsx-projects.css', array(), LSX_PROJECTS_VER ); |
|
68 | - wp_style_add_data( 'lsx-projects', 'rtl', 'replace' ); |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Allow data params for Slick slider addon. |
|
73 | - */ |
|
74 | - public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
75 | - $allowedtags['div']['data-slick'] = true; |
|
76 | - return $allowedtags; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Single template. |
|
81 | - */ |
|
82 | - public function single_template_include( $template ) { |
|
83 | - if ( is_main_query() && is_singular( 'project' ) ) { |
|
84 | - if ( empty( locate_template( array( 'single-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/single-projects.php' ) ) { |
|
85 | - $template = LSX_PROJECTS_PATH . 'templates/single-projects.php'; |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - return $template; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Archive template. |
|
94 | - */ |
|
95 | - public function archive_template_include( $template ) { |
|
96 | - if ( is_main_query() && ( is_post_type_archive( 'project' ) || is_tax( 'project-group' ) ) ) { |
|
97 | - if ( empty( locate_template( array( 'archive-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/archive-projects.php' ) ) { |
|
98 | - $template = LSX_PROJECTS_PATH . 'templates/archive-projects.php'; |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - return $template; |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Removes access to single project member posts. |
|
107 | - */ |
|
108 | - public function disable_single() { |
|
109 | - $queried_post_type = get_query_var( 'post_type' ); |
|
110 | - |
|
111 | - if ( is_single() && 'project' === $queried_post_type ) { |
|
112 | - wp_redirect( home_url(), 301 ); |
|
113 | - exit; |
|
114 | - } |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Handle body colours that might be change by LSX Customiser |
|
119 | - */ |
|
120 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
121 | - $css .= ' |
|
13 | + public function __construct() { |
|
14 | + $this->options = projects_get_options(); |
|
15 | + |
|
16 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 ); |
|
17 | + add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 ); |
|
18 | + add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
19 | + add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
20 | + |
|
21 | + if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
22 | + add_action( 'template_redirect', array( $this, 'disable_single' ) ); |
|
23 | + } |
|
24 | + |
|
25 | + if ( is_admin() ) { |
|
26 | + add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
27 | + } |
|
28 | + |
|
29 | + add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 ); |
|
30 | + |
|
31 | + add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) ); |
|
32 | + add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) ); |
|
33 | + add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) ); |
|
34 | + |
|
35 | + add_filter( 'pre_get_posts', array( $this, 'posts_per_page' ) ); |
|
36 | + add_action( 'wp_footer', array( $this, 'add_form_modal' ) ); |
|
37 | + } |
|
38 | + |
|
39 | + public function enqueue_scripts() { |
|
40 | + $has_slick = wp_script_is( 'slick', 'queue' ); |
|
41 | + |
|
42 | + if ( ! $has_slick ) { |
|
43 | + wp_enqueue_style( 'slick', LSX_PROJECTS_URL . 'assets/css/vendor/slick.css', array(), LSX_PROJECTS_VER, null ); |
|
44 | + wp_enqueue_script( 'slick', LSX_PROJECTS_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
45 | + } |
|
46 | + |
|
47 | + $has_scrolltofixed = wp_script_is( 'scrolltofixed', 'queue' ); |
|
48 | + |
|
49 | + if ( ! $has_scrolltofixed ) { |
|
50 | + wp_enqueue_script( 'scrolltofixed', LSX_PROJECTS_URL . 'assets/js/vendor/jquery-scrolltofixed-min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
51 | + } |
|
52 | + |
|
53 | + $has_isotope = wp_script_is( 'isotope', 'queue' ); |
|
54 | + |
|
55 | + if ( ! $has_isotope ) { |
|
56 | + wp_enqueue_script( 'isotope', LSX_PROJECTS_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
57 | + } |
|
58 | + |
|
59 | + wp_enqueue_script( 'lsx-projects', LSX_PROJECTS_URL . 'assets/js/lsx-projects.min.js', array( 'jquery', 'slick', 'scrolltofixed', 'isotope' ), LSX_PROJECTS_VER, true ); |
|
60 | + |
|
61 | + $params = apply_filters( 'lsx_projects_js_params', array( |
|
62 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
63 | + )); |
|
64 | + |
|
65 | + wp_localize_script( 'lsx-projects', 'lsx_customizer_params', $params ); |
|
66 | + |
|
67 | + wp_enqueue_style( 'lsx-projects', LSX_PROJECTS_URL . 'assets/css/lsx-projects.css', array(), LSX_PROJECTS_VER ); |
|
68 | + wp_style_add_data( 'lsx-projects', 'rtl', 'replace' ); |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Allow data params for Slick slider addon. |
|
73 | + */ |
|
74 | + public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
75 | + $allowedtags['div']['data-slick'] = true; |
|
76 | + return $allowedtags; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Single template. |
|
81 | + */ |
|
82 | + public function single_template_include( $template ) { |
|
83 | + if ( is_main_query() && is_singular( 'project' ) ) { |
|
84 | + if ( empty( locate_template( array( 'single-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/single-projects.php' ) ) { |
|
85 | + $template = LSX_PROJECTS_PATH . 'templates/single-projects.php'; |
|
86 | + } |
|
87 | + } |
|
88 | + |
|
89 | + return $template; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Archive template. |
|
94 | + */ |
|
95 | + public function archive_template_include( $template ) { |
|
96 | + if ( is_main_query() && ( is_post_type_archive( 'project' ) || is_tax( 'project-group' ) ) ) { |
|
97 | + if ( empty( locate_template( array( 'archive-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/archive-projects.php' ) ) { |
|
98 | + $template = LSX_PROJECTS_PATH . 'templates/archive-projects.php'; |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + return $template; |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Removes access to single project member posts. |
|
107 | + */ |
|
108 | + public function disable_single() { |
|
109 | + $queried_post_type = get_query_var( 'post_type' ); |
|
110 | + |
|
111 | + if ( is_single() && 'project' === $queried_post_type ) { |
|
112 | + wp_redirect( home_url(), 301 ); |
|
113 | + exit; |
|
114 | + } |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Handle body colours that might be change by LSX Customiser |
|
119 | + */ |
|
120 | + public function customizer_body_colours_handler( $css, $colors ) { |
|
121 | + $css .= ' |
|
122 | 122 | @import "' . LSX_PROJECTS_PATH . '/assets/css/scss/customizer-projects-body-colours"; |
123 | 123 | |
124 | 124 | /** |
@@ -134,104 +134,104 @@ discard block |
||
134 | 134 | ); |
135 | 135 | '; |
136 | 136 | |
137 | - return $css; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * Change the LSX Banners title for project archive. |
|
142 | - */ |
|
143 | - public function lsx_banner_archive_title( $title ) { |
|
144 | - if ( is_main_query() && is_post_type_archive( 'project' ) ) { |
|
145 | - $title = '<h1 class="page-title">' . esc_html__( 'Portfolio', 'lsx-projects' ) . '</h1>'; |
|
146 | - } |
|
147 | - |
|
148 | - if ( is_main_query() && is_tax( 'project-group' ) ) { |
|
149 | - $tax = get_queried_object(); |
|
150 | - $title = '<h1 class="page-title">' . esc_html__( 'Project Type', 'lsx-projects' ) . ': ' . apply_filters( 'the_title', $tax->name ) . '</h1>'; |
|
151 | - } |
|
152 | - |
|
153 | - return $title; |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * Remove the "continue reading" when the single is disabled. |
|
158 | - */ |
|
159 | - public function change_excerpt_more( $excerpt_more ) { |
|
160 | - global $post; |
|
161 | - |
|
162 | - if ( 'project' === $post->post_type ) { |
|
163 | - if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
164 | - $excerpt_more = ''; |
|
165 | - } |
|
166 | - } |
|
167 | - |
|
168 | - return $excerpt_more; |
|
169 | - } |
|
170 | - |
|
171 | - /** |
|
172 | - * Change the word count when crop the content to excerpt (homepage widget). |
|
173 | - */ |
|
174 | - public function change_excerpt_length( $excerpt_word_count ) { |
|
175 | - global $post; |
|
176 | - |
|
177 | - if ( is_front_page() && 'project' === $post->post_type ) { |
|
178 | - $excerpt_word_count = 20; |
|
179 | - } |
|
180 | - |
|
181 | - if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
182 | - $excerpt_word_count = 20; |
|
183 | - } |
|
184 | - |
|
185 | - return $excerpt_word_count; |
|
186 | - } |
|
187 | - |
|
188 | - /** |
|
189 | - * Change the allowed tags crop the content to excerpt (homepage widget). |
|
190 | - */ |
|
191 | - public function change_excerpt_strip_tags( $allowed_tags ) { |
|
192 | - global $post; |
|
193 | - |
|
194 | - if ( is_front_page() && 'project' === $post->post_type ) { |
|
195 | - $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
196 | - } |
|
197 | - |
|
198 | - if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
199 | - $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
200 | - } |
|
201 | - |
|
202 | - return $allowed_tags; |
|
203 | - } |
|
204 | - |
|
205 | - /** |
|
206 | - * Change posts per page counter for archive. |
|
207 | - */ |
|
208 | - public function posts_per_page( $query ) { |
|
209 | - if ( ! is_admin() && $query->is_main_query() ) { |
|
210 | - if ( $query->is_post_type_archive( 'project' ) || $query->is_tax( 'project-group' ) ) { |
|
211 | - $query->set( 'posts_per_page', -1 ); |
|
212 | - } |
|
213 | - } |
|
214 | - |
|
215 | - return $query; |
|
216 | - } |
|
217 | - |
|
218 | - /** |
|
219 | - * Add form modal |
|
220 | - */ |
|
221 | - public function add_form_modal() { |
|
222 | - |
|
223 | - if ( empty( $this->options['display']['projects_modal_enable'] ) ) { |
|
224 | - return ''; |
|
225 | - } |
|
226 | - |
|
227 | - if ( empty( $this->options['display']['projects_modal_cta_label'] ) || empty( $this->options['display']['projects_modal_form_id'] ) || empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
228 | - return ''; |
|
229 | - } |
|
230 | - |
|
231 | - if ( ! is_singular( 'project' ) ) { |
|
232 | - return ''; |
|
233 | - } |
|
234 | - ?> |
|
137 | + return $css; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * Change the LSX Banners title for project archive. |
|
142 | + */ |
|
143 | + public function lsx_banner_archive_title( $title ) { |
|
144 | + if ( is_main_query() && is_post_type_archive( 'project' ) ) { |
|
145 | + $title = '<h1 class="page-title">' . esc_html__( 'Portfolio', 'lsx-projects' ) . '</h1>'; |
|
146 | + } |
|
147 | + |
|
148 | + if ( is_main_query() && is_tax( 'project-group' ) ) { |
|
149 | + $tax = get_queried_object(); |
|
150 | + $title = '<h1 class="page-title">' . esc_html__( 'Project Type', 'lsx-projects' ) . ': ' . apply_filters( 'the_title', $tax->name ) . '</h1>'; |
|
151 | + } |
|
152 | + |
|
153 | + return $title; |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * Remove the "continue reading" when the single is disabled. |
|
158 | + */ |
|
159 | + public function change_excerpt_more( $excerpt_more ) { |
|
160 | + global $post; |
|
161 | + |
|
162 | + if ( 'project' === $post->post_type ) { |
|
163 | + if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
164 | + $excerpt_more = ''; |
|
165 | + } |
|
166 | + } |
|
167 | + |
|
168 | + return $excerpt_more; |
|
169 | + } |
|
170 | + |
|
171 | + /** |
|
172 | + * Change the word count when crop the content to excerpt (homepage widget). |
|
173 | + */ |
|
174 | + public function change_excerpt_length( $excerpt_word_count ) { |
|
175 | + global $post; |
|
176 | + |
|
177 | + if ( is_front_page() && 'project' === $post->post_type ) { |
|
178 | + $excerpt_word_count = 20; |
|
179 | + } |
|
180 | + |
|
181 | + if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
182 | + $excerpt_word_count = 20; |
|
183 | + } |
|
184 | + |
|
185 | + return $excerpt_word_count; |
|
186 | + } |
|
187 | + |
|
188 | + /** |
|
189 | + * Change the allowed tags crop the content to excerpt (homepage widget). |
|
190 | + */ |
|
191 | + public function change_excerpt_strip_tags( $allowed_tags ) { |
|
192 | + global $post; |
|
193 | + |
|
194 | + if ( is_front_page() && 'project' === $post->post_type ) { |
|
195 | + $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
196 | + } |
|
197 | + |
|
198 | + if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
199 | + $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
|
200 | + } |
|
201 | + |
|
202 | + return $allowed_tags; |
|
203 | + } |
|
204 | + |
|
205 | + /** |
|
206 | + * Change posts per page counter for archive. |
|
207 | + */ |
|
208 | + public function posts_per_page( $query ) { |
|
209 | + if ( ! is_admin() && $query->is_main_query() ) { |
|
210 | + if ( $query->is_post_type_archive( 'project' ) || $query->is_tax( 'project-group' ) ) { |
|
211 | + $query->set( 'posts_per_page', -1 ); |
|
212 | + } |
|
213 | + } |
|
214 | + |
|
215 | + return $query; |
|
216 | + } |
|
217 | + |
|
218 | + /** |
|
219 | + * Add form modal |
|
220 | + */ |
|
221 | + public function add_form_modal() { |
|
222 | + |
|
223 | + if ( empty( $this->options['display']['projects_modal_enable'] ) ) { |
|
224 | + return ''; |
|
225 | + } |
|
226 | + |
|
227 | + if ( empty( $this->options['display']['projects_modal_cta_label'] ) || empty( $this->options['display']['projects_modal_form_id'] ) || empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
228 | + return ''; |
|
229 | + } |
|
230 | + |
|
231 | + if ( ! is_singular( 'project' ) ) { |
|
232 | + return ''; |
|
233 | + } |
|
234 | + ?> |
|
235 | 235 | <div class="lsx-modal modal fade" id="lsx-project-contact" role="dialog"> |
236 | 236 | <div class="modal-dialog"> |
237 | 237 | <div class="modal-content"> |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | |
244 | 244 | <div class="modal-body"> |
245 | 245 | <?php |
246 | - if ( ! empty( $this->options['display']['projects_modal_form_id'] ) ) { |
|
247 | - echo do_shortcode( '[caldera_form id="' . $this->options['display']['projects_modal_form_id'] . '"]' ); |
|
248 | - } elseif ( ! empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
249 | - echo do_shortcode( '[wpforms id="' . $this->options['display']['projects_wpform_modal_form_id'] . '"]' ); |
|
250 | - } ?> |
|
246 | + if ( ! empty( $this->options['display']['projects_modal_form_id'] ) ) { |
|
247 | + echo do_shortcode( '[caldera_form id="' . $this->options['display']['projects_modal_form_id'] . '"]' ); |
|
248 | + } elseif ( ! empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
249 | + echo do_shortcode( '[wpforms id="' . $this->options['display']['projects_wpform_modal_form_id'] . '"]' ); |
|
250 | + } ?> |
|
251 | 251 | </div> |
252 | 252 | </div> |
253 | 253 | </div> |
254 | 254 | </div> |
255 | 255 | <?php |
256 | - } |
|
256 | + } |
|
257 | 257 | |
258 | 258 | } |
259 | 259 |
@@ -13,65 +13,65 @@ discard block |
||
13 | 13 | public function __construct() { |
14 | 14 | $this->options = projects_get_options(); |
15 | 15 | |
16 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 5 ); |
|
17 | - add_filter( 'wp_kses_allowed_html', array( $this, 'wp_kses_allowed_html' ), 10, 2 ); |
|
18 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
19 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
16 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), 5); |
|
17 | + add_filter('wp_kses_allowed_html', array($this, 'wp_kses_allowed_html'), 10, 2); |
|
18 | + add_filter('template_include', array($this, 'single_template_include'), 99); |
|
19 | + add_filter('template_include', array($this, 'archive_template_include'), 99); |
|
20 | 20 | |
21 | - if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
22 | - add_action( 'template_redirect', array( $this, 'disable_single' ) ); |
|
21 | + if ( ! empty($this->options['display']['projects_disable_single'])) { |
|
22 | + add_action('template_redirect', array($this, 'disable_single')); |
|
23 | 23 | } |
24 | 24 | |
25 | - if ( is_admin() ) { |
|
26 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
25 | + if (is_admin()) { |
|
26 | + add_filter('lsx_customizer_colour_selectors_body', array($this, 'customizer_body_colours_handler'), 15, 2); |
|
27 | 27 | } |
28 | 28 | |
29 | - add_filter( 'lsx_banner_title', array( $this, 'lsx_banner_archive_title' ), 15 ); |
|
29 | + add_filter('lsx_banner_title', array($this, 'lsx_banner_archive_title'), 15); |
|
30 | 30 | |
31 | - add_filter( 'excerpt_more_p', array( $this, 'change_excerpt_more' ) ); |
|
32 | - add_filter( 'excerpt_length', array( $this, 'change_excerpt_length' ) ); |
|
33 | - add_filter( 'excerpt_strip_tags', array( $this, 'change_excerpt_strip_tags' ) ); |
|
31 | + add_filter('excerpt_more_p', array($this, 'change_excerpt_more')); |
|
32 | + add_filter('excerpt_length', array($this, 'change_excerpt_length')); |
|
33 | + add_filter('excerpt_strip_tags', array($this, 'change_excerpt_strip_tags')); |
|
34 | 34 | |
35 | - add_filter( 'pre_get_posts', array( $this, 'posts_per_page' ) ); |
|
36 | - add_action( 'wp_footer', array( $this, 'add_form_modal' ) ); |
|
35 | + add_filter('pre_get_posts', array($this, 'posts_per_page')); |
|
36 | + add_action('wp_footer', array($this, 'add_form_modal')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function enqueue_scripts() { |
40 | - $has_slick = wp_script_is( 'slick', 'queue' ); |
|
40 | + $has_slick = wp_script_is('slick', 'queue'); |
|
41 | 41 | |
42 | - if ( ! $has_slick ) { |
|
43 | - wp_enqueue_style( 'slick', LSX_PROJECTS_URL . 'assets/css/vendor/slick.css', array(), LSX_PROJECTS_VER, null ); |
|
44 | - wp_enqueue_script( 'slick', LSX_PROJECTS_URL . 'assets/js/vendor/slick.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
42 | + if ( ! $has_slick) { |
|
43 | + wp_enqueue_style('slick', LSX_PROJECTS_URL . 'assets/css/vendor/slick.css', array(), LSX_PROJECTS_VER, null); |
|
44 | + wp_enqueue_script('slick', LSX_PROJECTS_URL . 'assets/js/vendor/slick.min.js', array('jquery'), null, LSX_PROJECTS_VER, true); |
|
45 | 45 | } |
46 | 46 | |
47 | - $has_scrolltofixed = wp_script_is( 'scrolltofixed', 'queue' ); |
|
47 | + $has_scrolltofixed = wp_script_is('scrolltofixed', 'queue'); |
|
48 | 48 | |
49 | - if ( ! $has_scrolltofixed ) { |
|
50 | - wp_enqueue_script( 'scrolltofixed', LSX_PROJECTS_URL . 'assets/js/vendor/jquery-scrolltofixed-min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
49 | + if ( ! $has_scrolltofixed) { |
|
50 | + wp_enqueue_script('scrolltofixed', LSX_PROJECTS_URL . 'assets/js/vendor/jquery-scrolltofixed-min.js', array('jquery'), null, LSX_PROJECTS_VER, true); |
|
51 | 51 | } |
52 | 52 | |
53 | - $has_isotope = wp_script_is( 'isotope', 'queue' ); |
|
53 | + $has_isotope = wp_script_is('isotope', 'queue'); |
|
54 | 54 | |
55 | - if ( ! $has_isotope ) { |
|
56 | - wp_enqueue_script( 'isotope', LSX_PROJECTS_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_PROJECTS_VER, true ); |
|
55 | + if ( ! $has_isotope) { |
|
56 | + wp_enqueue_script('isotope', LSX_PROJECTS_URL . 'assets/js/vendor/isotope.pkgd.min.js', array('jquery'), null, LSX_PROJECTS_VER, true); |
|
57 | 57 | } |
58 | 58 | |
59 | - wp_enqueue_script( 'lsx-projects', LSX_PROJECTS_URL . 'assets/js/lsx-projects.min.js', array( 'jquery', 'slick', 'scrolltofixed', 'isotope' ), LSX_PROJECTS_VER, true ); |
|
59 | + wp_enqueue_script('lsx-projects', LSX_PROJECTS_URL . 'assets/js/lsx-projects.min.js', array('jquery', 'slick', 'scrolltofixed', 'isotope'), LSX_PROJECTS_VER, true); |
|
60 | 60 | |
61 | - $params = apply_filters( 'lsx_projects_js_params', array( |
|
62 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
61 | + $params = apply_filters('lsx_projects_js_params', array( |
|
62 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
63 | 63 | )); |
64 | 64 | |
65 | - wp_localize_script( 'lsx-projects', 'lsx_customizer_params', $params ); |
|
65 | + wp_localize_script('lsx-projects', 'lsx_customizer_params', $params); |
|
66 | 66 | |
67 | - wp_enqueue_style( 'lsx-projects', LSX_PROJECTS_URL . 'assets/css/lsx-projects.css', array(), LSX_PROJECTS_VER ); |
|
68 | - wp_style_add_data( 'lsx-projects', 'rtl', 'replace' ); |
|
67 | + wp_enqueue_style('lsx-projects', LSX_PROJECTS_URL . 'assets/css/lsx-projects.css', array(), LSX_PROJECTS_VER); |
|
68 | + wp_style_add_data('lsx-projects', 'rtl', 'replace'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Allow data params for Slick slider addon. |
73 | 73 | */ |
74 | - public function wp_kses_allowed_html( $allowedtags, $context ) { |
|
74 | + public function wp_kses_allowed_html($allowedtags, $context) { |
|
75 | 75 | $allowedtags['div']['data-slick'] = true; |
76 | 76 | return $allowedtags; |
77 | 77 | } |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * Single template. |
81 | 81 | */ |
82 | - public function single_template_include( $template ) { |
|
83 | - if ( is_main_query() && is_singular( 'project' ) ) { |
|
84 | - if ( empty( locate_template( array( 'single-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/single-projects.php' ) ) { |
|
82 | + public function single_template_include($template) { |
|
83 | + if (is_main_query() && is_singular('project')) { |
|
84 | + if (empty(locate_template(array('single-projects.php'))) && file_exists(LSX_PROJECTS_PATH . 'templates/single-projects.php')) { |
|
85 | 85 | $template = LSX_PROJECTS_PATH . 'templates/single-projects.php'; |
86 | 86 | } |
87 | 87 | } |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | /** |
93 | 93 | * Archive template. |
94 | 94 | */ |
95 | - public function archive_template_include( $template ) { |
|
96 | - if ( is_main_query() && ( is_post_type_archive( 'project' ) || is_tax( 'project-group' ) ) ) { |
|
97 | - if ( empty( locate_template( array( 'archive-projects.php' ) ) ) && file_exists( LSX_PROJECTS_PATH . 'templates/archive-projects.php' ) ) { |
|
95 | + public function archive_template_include($template) { |
|
96 | + if (is_main_query() && (is_post_type_archive('project') || is_tax('project-group'))) { |
|
97 | + if (empty(locate_template(array('archive-projects.php'))) && file_exists(LSX_PROJECTS_PATH . 'templates/archive-projects.php')) { |
|
98 | 98 | $template = LSX_PROJECTS_PATH . 'templates/archive-projects.php'; |
99 | 99 | } |
100 | 100 | } |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | * Removes access to single project member posts. |
107 | 107 | */ |
108 | 108 | public function disable_single() { |
109 | - $queried_post_type = get_query_var( 'post_type' ); |
|
109 | + $queried_post_type = get_query_var('post_type'); |
|
110 | 110 | |
111 | - if ( is_single() && 'project' === $queried_post_type ) { |
|
112 | - wp_redirect( home_url(), 301 ); |
|
111 | + if (is_single() && 'project' === $queried_post_type) { |
|
112 | + wp_redirect(home_url(), 301); |
|
113 | 113 | exit; |
114 | 114 | } |
115 | 115 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | /** |
118 | 118 | * Handle body colours that might be change by LSX Customiser |
119 | 119 | */ |
120 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
120 | + public function customizer_body_colours_handler($css, $colors) { |
|
121 | 121 | $css .= ' |
122 | 122 | @import "' . LSX_PROJECTS_PATH . '/assets/css/scss/customizer-projects-body-colours"; |
123 | 123 | |
@@ -140,14 +140,14 @@ discard block |
||
140 | 140 | /** |
141 | 141 | * Change the LSX Banners title for project archive. |
142 | 142 | */ |
143 | - public function lsx_banner_archive_title( $title ) { |
|
144 | - if ( is_main_query() && is_post_type_archive( 'project' ) ) { |
|
145 | - $title = '<h1 class="page-title">' . esc_html__( 'Portfolio', 'lsx-projects' ) . '</h1>'; |
|
143 | + public function lsx_banner_archive_title($title) { |
|
144 | + if (is_main_query() && is_post_type_archive('project')) { |
|
145 | + $title = '<h1 class="page-title">' . esc_html__('Portfolio', 'lsx-projects') . '</h1>'; |
|
146 | 146 | } |
147 | 147 | |
148 | - if ( is_main_query() && is_tax( 'project-group' ) ) { |
|
148 | + if (is_main_query() && is_tax('project-group')) { |
|
149 | 149 | $tax = get_queried_object(); |
150 | - $title = '<h1 class="page-title">' . esc_html__( 'Project Type', 'lsx-projects' ) . ': ' . apply_filters( 'the_title', $tax->name ) . '</h1>'; |
|
150 | + $title = '<h1 class="page-title">' . esc_html__('Project Type', 'lsx-projects') . ': ' . apply_filters('the_title', $tax->name) . '</h1>'; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return $title; |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | /** |
157 | 157 | * Remove the "continue reading" when the single is disabled. |
158 | 158 | */ |
159 | - public function change_excerpt_more( $excerpt_more ) { |
|
159 | + public function change_excerpt_more($excerpt_more) { |
|
160 | 160 | global $post; |
161 | 161 | |
162 | - if ( 'project' === $post->post_type ) { |
|
163 | - if ( ! empty( $this->options['display']['projects_disable_single'] ) ) { |
|
162 | + if ('project' === $post->post_type) { |
|
163 | + if ( ! empty($this->options['display']['projects_disable_single'])) { |
|
164 | 164 | $excerpt_more = ''; |
165 | 165 | } |
166 | 166 | } |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * Change the word count when crop the content to excerpt (homepage widget). |
173 | 173 | */ |
174 | - public function change_excerpt_length( $excerpt_word_count ) { |
|
174 | + public function change_excerpt_length($excerpt_word_count) { |
|
175 | 175 | global $post; |
176 | 176 | |
177 | - if ( is_front_page() && 'project' === $post->post_type ) { |
|
177 | + if (is_front_page() && 'project' === $post->post_type) { |
|
178 | 178 | $excerpt_word_count = 20; |
179 | 179 | } |
180 | 180 | |
181 | - if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
181 | + if (is_singular('project') && ('team' === $post->post_type || 'testimonial' === $post->post_type)) { |
|
182 | 182 | $excerpt_word_count = 20; |
183 | 183 | } |
184 | 184 | |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | /** |
189 | 189 | * Change the allowed tags crop the content to excerpt (homepage widget). |
190 | 190 | */ |
191 | - public function change_excerpt_strip_tags( $allowed_tags ) { |
|
191 | + public function change_excerpt_strip_tags($allowed_tags) { |
|
192 | 192 | global $post; |
193 | 193 | |
194 | - if ( is_front_page() && 'project' === $post->post_type ) { |
|
194 | + if (is_front_page() && 'project' === $post->post_type) { |
|
195 | 195 | $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
196 | 196 | } |
197 | 197 | |
198 | - if ( is_singular( 'project' ) && ( 'team' === $post->post_type || 'testimonial' === $post->post_type ) ) { |
|
198 | + if (is_singular('project') && ('team' === $post->post_type || 'testimonial' === $post->post_type)) { |
|
199 | 199 | $allowed_tags = '<p>,<br>,<b>,<strong>,<i>,<u>,<ul>,<ol>,<li>,<span>'; |
200 | 200 | } |
201 | 201 | |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | /** |
206 | 206 | * Change posts per page counter for archive. |
207 | 207 | */ |
208 | - public function posts_per_page( $query ) { |
|
209 | - if ( ! is_admin() && $query->is_main_query() ) { |
|
210 | - if ( $query->is_post_type_archive( 'project' ) || $query->is_tax( 'project-group' ) ) { |
|
211 | - $query->set( 'posts_per_page', -1 ); |
|
208 | + public function posts_per_page($query) { |
|
209 | + if ( ! is_admin() && $query->is_main_query()) { |
|
210 | + if ($query->is_post_type_archive('project') || $query->is_tax('project-group')) { |
|
211 | + $query->set('posts_per_page', -1); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function add_form_modal() { |
222 | 222 | |
223 | - if ( empty( $this->options['display']['projects_modal_enable'] ) ) { |
|
223 | + if (empty($this->options['display']['projects_modal_enable'])) { |
|
224 | 224 | return ''; |
225 | 225 | } |
226 | 226 | |
227 | - if ( empty( $this->options['display']['projects_modal_cta_label'] ) || empty( $this->options['display']['projects_modal_form_id'] ) || empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
227 | + if (empty($this->options['display']['projects_modal_cta_label']) || empty($this->options['display']['projects_modal_form_id']) || empty($this->options['display']['projects_wpform_modal_form_id'])) { |
|
228 | 228 | return ''; |
229 | 229 | } |
230 | 230 | |
231 | - if ( ! is_singular( 'project' ) ) { |
|
231 | + if ( ! is_singular('project')) { |
|
232 | 232 | return ''; |
233 | 233 | } |
234 | 234 | ?> |
@@ -238,15 +238,15 @@ discard block |
||
238 | 238 | <button type="button" class="close" data-dismiss="modal">×</button> |
239 | 239 | |
240 | 240 | <div class="modal-header"> |
241 | - <h4 class="modal-title"><?php echo esc_html( $this->options['display']['projects_modal_cta_label'] ); ?></h4> |
|
241 | + <h4 class="modal-title"><?php echo esc_html($this->options['display']['projects_modal_cta_label']); ?></h4> |
|
242 | 242 | </div> |
243 | 243 | |
244 | 244 | <div class="modal-body"> |
245 | 245 | <?php |
246 | - if ( ! empty( $this->options['display']['projects_modal_form_id'] ) ) { |
|
247 | - echo do_shortcode( '[caldera_form id="' . $this->options['display']['projects_modal_form_id'] . '"]' ); |
|
248 | - } elseif ( ! empty( $this->options['display']['projects_wpform_modal_form_id'] ) ) { |
|
249 | - echo do_shortcode( '[wpforms id="' . $this->options['display']['projects_wpform_modal_form_id'] . '"]' ); |
|
246 | + if ( ! empty($this->options['display']['projects_modal_form_id'])) { |
|
247 | + echo do_shortcode('[caldera_form id="' . $this->options['display']['projects_modal_form_id'] . '"]'); |
|
248 | + } elseif ( ! empty($this->options['display']['projects_wpform_modal_form_id'])) { |
|
249 | + echo do_shortcode('[wpforms id="' . $this->options['display']['projects_wpform_modal_form_id'] . '"]'); |
|
250 | 250 | } ?> |
251 | 251 | </div> |
252 | 252 | </div> |