@@ -1,147 +1,147 @@ |
||
1 | 1 | <div class="uix-field-wrapper"> |
2 | 2 | <ul class="ui-tab-nav"> |
3 | - <?php if ( class_exists( 'LSX_Banners' ) ) { ?> |
|
4 | - <li><a href="#ui-placeholders" class="active"><?php esc_html_e( 'Placeholders', 'lsx-projects' ); ?></a></li> |
|
3 | + <?php if (class_exists('LSX_Banners')) { ?> |
|
4 | + <li><a href="#ui-placeholders" class="active"><?php esc_html_e('Placeholders', 'lsx-projects'); ?></a></li> |
|
5 | 5 | <?php } ?> |
6 | 6 | |
7 | - <?php if ( class_exists( 'LSX_Currencies' ) ) { ?> |
|
8 | - <?php $class_active = class_exists( 'LSX_Banners' ) ? '' : 'active' ?> |
|
9 | - <li><a href="#ui-currencies" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Currencies', 'lsx-projects' ); ?></a></li> |
|
7 | + <?php if (class_exists('LSX_Currencies')) { ?> |
|
8 | + <?php $class_active = class_exists('LSX_Banners') ? '' : 'active' ?> |
|
9 | + <li><a href="#ui-currencies" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Currencies', 'lsx-projects'); ?></a></li> |
|
10 | 10 | <?php } ?> |
11 | 11 | |
12 | - <?php if ( class_exists( 'LSX_Team' ) ) { ?> |
|
13 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) ) ? '' : 'active' ?> |
|
14 | - <li><a href="#ui-team" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Team', 'lsx-projects' ); ?></a></li> |
|
12 | + <?php if (class_exists('LSX_Team')) { ?> |
|
13 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies')) ? '' : 'active' ?> |
|
14 | + <li><a href="#ui-team" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Team', 'lsx-projects'); ?></a></li> |
|
15 | 15 | <?php } ?> |
16 | 16 | |
17 | - <?php if ( class_exists( 'LSX_Testimonials' ) ) { ?> |
|
18 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) ) ? '' : 'active' ?> |
|
19 | - <li><a href="#ui-testimonials" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Testimonials', 'lsx-projects' ); ?></a></li> |
|
17 | + <?php if (class_exists('LSX_Testimonials')) { ?> |
|
18 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team')) ? '' : 'active' ?> |
|
19 | + <li><a href="#ui-testimonials" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Testimonials', 'lsx-projects'); ?></a></li> |
|
20 | 20 | <?php } ?> |
21 | 21 | |
22 | - <?php if ( class_exists( 'LSX_Projects' ) ) { ?> |
|
23 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) ) ? '' : 'active' ?> |
|
24 | - <li><a href="#ui-projects" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Projects', 'lsx-projects' ); ?></a></li> |
|
22 | + <?php if (class_exists('LSX_Projects')) { ?> |
|
23 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials')) ? '' : 'active' ?> |
|
24 | + <li><a href="#ui-projects" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Projects', 'lsx-projects'); ?></a></li> |
|
25 | 25 | <?php } ?> |
26 | 26 | |
27 | - <?php if ( class_exists( 'LSX_Services' ) ) { ?> |
|
28 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) ) ? '' : 'active' ?> |
|
29 | - <li><a href="#ui-services" class="<?php echo esc_attr( $class ) ?>"><?php esc_html_e( 'Services', 'lsx-projects' ); ?></a></li> |
|
27 | + <?php if (class_exists('LSX_Services')) { ?> |
|
28 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects')) ? '' : 'active' ?> |
|
29 | + <li><a href="#ui-services" class="<?php echo esc_attr($class) ?>"><?php esc_html_e('Services', 'lsx-projects'); ?></a></li> |
|
30 | 30 | <?php $class = ''; } ?> |
31 | 31 | |
32 | - <?php if ( class_exists( 'LSX_Blog_Customizer' ) ) { ?> |
|
33 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) ) ? '' : 'active' ?> |
|
34 | - <li><a href="#ui-blog-customizer" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Blog Customizer (posts widget)', 'lsx-projects' ); ?></a></li> |
|
32 | + <?php if (class_exists('LSX_Blog_Customizer')) { ?> |
|
33 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services')) ? '' : 'active' ?> |
|
34 | + <li><a href="#ui-blog-customizer" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Blog Customizer (posts widget)', 'lsx-projects'); ?></a></li> |
|
35 | 35 | <?php } ?> |
36 | 36 | |
37 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { ?> |
|
38 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) || class_exists( 'LSX_Blog_Customizer' ) ) ? '' : 'active' ?> |
|
39 | - <li><a href="#ui-sharing" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Sharing', 'lsx-projects' ); ?></a></li> |
|
37 | + <?php if (class_exists('LSX_Sharing')) { ?> |
|
38 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer')) ? '' : 'active' ?> |
|
39 | + <li><a href="#ui-sharing" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Sharing', 'lsx-projects'); ?></a></li> |
|
40 | 40 | <?php } ?> |
41 | 41 | |
42 | - <?php if ( class_exists( 'LSX_Videos' ) ) { ?> |
|
43 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) || class_exists( 'LSX_Blog_Customizer' ) || class_exists( 'LSX_Sharing' ) ) ? '' : 'active' ?> |
|
44 | - <li><a href="#ui-videos" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Videos', 'lsx-projects' ); ?></a></li> |
|
42 | + <?php if (class_exists('LSX_Videos')) { ?> |
|
43 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing')) ? '' : 'active' ?> |
|
44 | + <li><a href="#ui-videos" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Videos', 'lsx-projects'); ?></a></li> |
|
45 | 45 | <?php } ?> |
46 | 46 | </ul> |
47 | 47 | |
48 | - <?php if ( class_exists( 'LSX_Banners' ) ) { ?> |
|
48 | + <?php if (class_exists('LSX_Banners')) { ?> |
|
49 | 49 | <div id="ui-placeholders" class="ui-tab active"> |
50 | 50 | <table class="form-table"> |
51 | 51 | <tbody> |
52 | - <?php do_action( 'lsx_framework_display_tab_content', 'placeholders' ); ?> |
|
52 | + <?php do_action('lsx_framework_display_tab_content', 'placeholders'); ?> |
|
53 | 53 | </tbody> |
54 | 54 | </table> |
55 | 55 | </div> |
56 | 56 | <?php } ?> |
57 | 57 | |
58 | - <?php if ( class_exists( 'LSX_Currencies' ) ) { ?> |
|
59 | - <?php $class_active = class_exists( 'LSX_Banners' ) ? '' : 'active' ?> |
|
60 | - <div id="ui-currencies" class="ui-tab <?php echo esc_attr( $class_active ) ?>"> |
|
58 | + <?php if (class_exists('LSX_Currencies')) { ?> |
|
59 | + <?php $class_active = class_exists('LSX_Banners') ? '' : 'active' ?> |
|
60 | + <div id="ui-currencies" class="ui-tab <?php echo esc_attr($class_active) ?>"> |
|
61 | 61 | <table class="form-table"> |
62 | 62 | <tbody> |
63 | - <?php do_action( 'lsx_framework_display_tab_content', 'currency_switcher' ); ?> |
|
63 | + <?php do_action('lsx_framework_display_tab_content', 'currency_switcher'); ?> |
|
64 | 64 | </tbody> |
65 | 65 | </table> |
66 | 66 | </div> |
67 | 67 | <?php } ?> |
68 | 68 | |
69 | - <?php if ( class_exists( 'LSX_Team' ) ) { ?> |
|
70 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) ) ? '' : 'active' ?> |
|
71 | - <div id="ui-team" class="ui-tab <?php echo esc_attr( $class_active ) ?>"> |
|
69 | + <?php if (class_exists('LSX_Team')) { ?> |
|
70 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies')) ? '' : 'active' ?> |
|
71 | + <div id="ui-team" class="ui-tab <?php echo esc_attr($class_active) ?>"> |
|
72 | 72 | <table class="form-table"> |
73 | 73 | <tbody> |
74 | - <?php do_action( 'lsx_framework_display_tab_content', 'team' ); ?> |
|
74 | + <?php do_action('lsx_framework_display_tab_content', 'team'); ?> |
|
75 | 75 | </tbody> |
76 | 76 | </table> |
77 | 77 | </div> |
78 | 78 | <?php } ?> |
79 | 79 | |
80 | - <?php if ( class_exists( 'LSX_Testimonials' ) ) { ?> |
|
81 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) ) ? '' : 'active' ?> |
|
82 | - <div id="ui-testimonials" class="ui-tab <?php echo esc_attr( $class_active ) ?>"> |
|
80 | + <?php if (class_exists('LSX_Testimonials')) { ?> |
|
81 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team')) ? '' : 'active' ?> |
|
82 | + <div id="ui-testimonials" class="ui-tab <?php echo esc_attr($class_active) ?>"> |
|
83 | 83 | <table class="form-table"> |
84 | 84 | <tbody> |
85 | - <?php do_action( 'lsx_framework_display_tab_content', 'testimonials' ); ?> |
|
85 | + <?php do_action('lsx_framework_display_tab_content', 'testimonials'); ?> |
|
86 | 86 | </tbody> |
87 | 87 | </table> |
88 | 88 | </div> |
89 | 89 | <?php } ?> |
90 | 90 | |
91 | - <?php if ( class_exists( 'LSX_Projects' ) ) { ?> |
|
92 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) ) ? '' : 'active' ?> |
|
93 | - <div id="ui-projects" class="ui-tab <?php echo esc_attr( $class_active ) ?>"> |
|
91 | + <?php if (class_exists('LSX_Projects')) { ?> |
|
92 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials')) ? '' : 'active' ?> |
|
93 | + <div id="ui-projects" class="ui-tab <?php echo esc_attr($class_active) ?>"> |
|
94 | 94 | <table class="form-table"> |
95 | 95 | <tbody> |
96 | - <?php do_action( 'lsx_framework_display_tab_content', 'projects' ); ?> |
|
96 | + <?php do_action('lsx_framework_display_tab_content', 'projects'); ?> |
|
97 | 97 | </tbody> |
98 | 98 | </table> |
99 | 99 | </div> |
100 | 100 | <?php } ?> |
101 | 101 | |
102 | - <?php if ( class_exists( 'LSX_Services' ) ) { ?> |
|
103 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) ) ? '' : 'active' ?> |
|
104 | - <div id="ui-services" class="ui-tab <?php echo esc_attr( $class_active ) ?>"> |
|
102 | + <?php if (class_exists('LSX_Services')) { ?> |
|
103 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects')) ? '' : 'active' ?> |
|
104 | + <div id="ui-services" class="ui-tab <?php echo esc_attr($class_active) ?>"> |
|
105 | 105 | <table class="form-table"> |
106 | 106 | <tbody> |
107 | - <?php do_action( 'lsx_framework_display_tab_content', 'services' ); ?> |
|
107 | + <?php do_action('lsx_framework_display_tab_content', 'services'); ?> |
|
108 | 108 | </tbody> |
109 | 109 | </table> |
110 | 110 | </div> |
111 | 111 | <?php } ?> |
112 | 112 | |
113 | - <?php if ( class_exists( 'LSX_Blog_Customizer' ) ) { ?> |
|
114 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) ) ? '' : 'active' ?> |
|
115 | - <div id="ui-blog-customizer" class="ui-tab <?php echo esc_attr( $class_active ) ?>"> |
|
113 | + <?php if (class_exists('LSX_Blog_Customizer')) { ?> |
|
114 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services')) ? '' : 'active' ?> |
|
115 | + <div id="ui-blog-customizer" class="ui-tab <?php echo esc_attr($class_active) ?>"> |
|
116 | 116 | <table class="form-table"> |
117 | 117 | <tbody> |
118 | - <?php do_action( 'lsx_framework_display_tab_content', 'blog-customizer' ); ?> |
|
118 | + <?php do_action('lsx_framework_display_tab_content', 'blog-customizer'); ?> |
|
119 | 119 | </tbody> |
120 | 120 | </table> |
121 | 121 | </div> |
122 | 122 | <?php } ?> |
123 | 123 | |
124 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { ?> |
|
125 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) || class_exists( 'LSX_Blog_Customizer' ) ) ? '' : 'active' ?> |
|
126 | - <div id="ui-sharing" class="ui-tab <?php echo esc_attr( $class_active ) ?>"> |
|
124 | + <?php if (class_exists('LSX_Sharing')) { ?> |
|
125 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer')) ? '' : 'active' ?> |
|
126 | + <div id="ui-sharing" class="ui-tab <?php echo esc_attr($class_active) ?>"> |
|
127 | 127 | <table class="form-table"> |
128 | 128 | <tbody> |
129 | - <?php do_action( 'lsx_framework_display_tab_content', 'sharing' ); ?> |
|
129 | + <?php do_action('lsx_framework_display_tab_content', 'sharing'); ?> |
|
130 | 130 | </tbody> |
131 | 131 | </table> |
132 | 132 | </div> |
133 | 133 | <?php } ?> |
134 | 134 | |
135 | - <?php if ( class_exists( 'LSX_Videos' ) ) { ?> |
|
136 | - <?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) || class_exists( 'LSX_Blog_Customizer' ) || class_exists( 'LSX_Sharing' ) ) ? '' : 'active' ?> |
|
137 | - <div id="ui-videos" class="ui-tab <?php echo esc_attr( $class_active ) ?>"> |
|
135 | + <?php if (class_exists('LSX_Videos')) { ?> |
|
136 | + <?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing')) ? '' : 'active' ?> |
|
137 | + <div id="ui-videos" class="ui-tab <?php echo esc_attr($class_active) ?>"> |
|
138 | 138 | <table class="form-table"> |
139 | 139 | <tbody> |
140 | - <?php do_action( 'lsx_framework_display_tab_content', 'videos' ); ?> |
|
140 | + <?php do_action('lsx_framework_display_tab_content', 'videos'); ?> |
|
141 | 141 | </tbody> |
142 | 142 | </table> |
143 | 143 | </div> |
144 | 144 | <?php } ?> |
145 | 145 | |
146 | - <?php do_action( 'lsx_framework_display_tab_bottom', 'display' ); ?> |
|
146 | + <?php do_action('lsx_framework_display_tab_bottom', 'display'); ?> |
|
147 | 147 | </div> |
@@ -14,45 +14,45 @@ discard block |
||
14 | 14 | class LSX_Projects_SCPO_Engine { |
15 | 15 | |
16 | 16 | function __construct() { |
17 | - if ( ! get_option( 'lsx_projects_scporder_install' ) ) { |
|
17 | + if ( ! get_option('lsx_projects_scporder_install')) { |
|
18 | 18 | $this->lsx_projects_scporder_install(); |
19 | 19 | } |
20 | 20 | |
21 | - add_action( 'admin_init', array( $this, 'refresh' ) ); |
|
22 | - add_action( 'admin_init', array( $this, 'load_script_css' ) ); |
|
21 | + add_action('admin_init', array($this, 'refresh')); |
|
22 | + add_action('admin_init', array($this, 'load_script_css')); |
|
23 | 23 | |
24 | - add_action( 'wp_ajax_update-menu-order', array( $this, 'update_menu_order' ) ); |
|
24 | + add_action('wp_ajax_update-menu-order', array($this, 'update_menu_order')); |
|
25 | 25 | |
26 | - add_action( 'pre_get_posts', array( $this, 'lsx_projects_scporder_pre_get_posts' ) ); |
|
26 | + add_action('pre_get_posts', array($this, 'lsx_projects_scporder_pre_get_posts')); |
|
27 | 27 | |
28 | - add_filter( 'get_previous_post_where', array( $this, 'lsx_projects_scporder_previous_post_where' ) ); |
|
29 | - add_filter( 'get_previous_post_sort', array( $this, 'lsx_projects_scporder_previous_post_sort' ) ); |
|
30 | - add_filter( 'get_next_post_where', array( $this, 'lsx_projects_scporder_next_post_where' ) ); |
|
31 | - add_filter( 'get_next_post_sort', array( $this, 'lsx_projects_scporder_next_post_sort' ) ); |
|
28 | + add_filter('get_previous_post_where', array($this, 'lsx_projects_scporder_previous_post_where')); |
|
29 | + add_filter('get_previous_post_sort', array($this, 'lsx_projects_scporder_previous_post_sort')); |
|
30 | + add_filter('get_next_post_where', array($this, 'lsx_projects_scporder_next_post_where')); |
|
31 | + add_filter('get_next_post_sort', array($this, 'lsx_projects_scporder_next_post_sort')); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | function lsx_projects_scporder_install() { |
35 | - update_option( 'lsx_projects_scporder_install', 1 ); |
|
35 | + update_option('lsx_projects_scporder_install', 1); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | function _check_load_script_css() { |
39 | 39 | $active = false; |
40 | 40 | $objects = $this->get_lsx_projects_scporder_options_objects(); |
41 | 41 | |
42 | - if ( empty( $objects ) ) { |
|
42 | + if (empty($objects)) { |
|
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | |
46 | - if ( isset( $_GET['orderby'] ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'action=edit' ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/post-new.php' ) ) { |
|
46 | + if (isset($_GET['orderby']) || strstr(sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])), 'action=edit') || strstr(sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])), 'wp-admin/post-new.php')) { |
|
47 | 47 | return false; |
48 | 48 | } |
49 | 49 | |
50 | - if ( ! empty( $objects ) ) { |
|
51 | - if ( isset( $_GET['post_type'] ) && ! isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_GET['post_type'] ) ), $objects ) ) { // if page or custom post types |
|
50 | + if ( ! empty($objects)) { |
|
51 | + if (isset($_GET['post_type']) && ! isset($_GET['taxonomy']) && array_key_exists(sanitize_text_field(wp_unslash($_GET['post_type'])), $objects)) { // if page or custom post types |
|
52 | 52 | $active = true; |
53 | 53 | } |
54 | 54 | |
55 | - if ( ! isset( $_GET['post_type'] ) && strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/edit.php' ) && array_key_exists( 'post', $objects ) ) { // if post |
|
55 | + if ( ! isset($_GET['post_type']) && strstr(sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])), 'wp-admin/edit.php') && array_key_exists('post', $objects)) { // if post |
|
56 | 56 | $active = true; |
57 | 57 | } |
58 | 58 | } |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | function load_script_css() { |
64 | - if ( $this->_check_load_script_css() ) { |
|
65 | - wp_enqueue_script( 'scporderjs', LSX_PROJECTS_URL . 'assets/js/scporder.min.js', array( 'jquery', 'jquery-ui-sortable' ), null, true ); |
|
64 | + if ($this->_check_load_script_css()) { |
|
65 | + wp_enqueue_script('scporderjs', LSX_PROJECTS_URL . 'assets/js/scporder.min.js', array('jquery', 'jquery-ui-sortable'), null, true); |
|
66 | 66 | |
67 | 67 | $scporderjs_params = array( |
68 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
69 | - 'ajax_nonce' => wp_create_nonce( 'scporder' ), |
|
68 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
69 | + 'ajax_nonce' => wp_create_nonce('scporder'), |
|
70 | 70 | ); |
71 | 71 | |
72 | - wp_localize_script( 'scporderjs', 'scporderjs_params', $scporderjs_params ); |
|
72 | + wp_localize_script('scporderjs', 'scporderjs_params', $scporderjs_params); |
|
73 | 73 | |
74 | - wp_enqueue_style( 'scporder', LSX_PROJECTS_URL . 'assets/css/scporder.css', array(), null ); |
|
74 | + wp_enqueue_style('scporder', LSX_PROJECTS_URL . 'assets/css/scporder.css', array(), null); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -80,26 +80,26 @@ discard block |
||
80 | 80 | |
81 | 81 | $objects = $this->get_lsx_projects_scporder_options_objects(); |
82 | 82 | |
83 | - if ( ! empty( $objects ) ) { |
|
84 | - foreach ( $objects as $object => $object_data ) { |
|
83 | + if ( ! empty($objects)) { |
|
84 | + foreach ($objects as $object => $object_data) { |
|
85 | 85 | $result = $wpdb->get_results($wpdb->prepare(" |
86 | 86 | SELECT count(*) as cnt, max(menu_order) as max, min(menu_order) as min |
87 | 87 | FROM $wpdb->posts |
88 | 88 | WHERE post_type = '%s' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future') |
89 | 89 | ", $object)); |
90 | 90 | |
91 | - if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) { |
|
91 | + if (0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max) { |
|
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | |
95 | - $results = $wpdb->get_results( $wpdb->prepare(" |
|
95 | + $results = $wpdb->get_results($wpdb->prepare(" |
|
96 | 96 | SELECT ID |
97 | 97 | FROM $wpdb->posts |
98 | 98 | WHERE post_type = '%s' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future') |
99 | 99 | ORDER BY menu_order ASC |
100 | - ", $object ) ); |
|
100 | + ", $object)); |
|
101 | 101 | |
102 | - foreach ( $results as $key => $result ) { |
|
102 | + foreach ($results as $key => $result) { |
|
103 | 103 | $wpdb->update( |
104 | 104 | $wpdb->posts, |
105 | 105 | array( |
@@ -115,61 +115,61 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | function update_menu_order() { |
118 | - check_ajax_referer( 'scporder', 'security' ); |
|
118 | + check_ajax_referer('scporder', 'security'); |
|
119 | 119 | |
120 | 120 | global $wpdb; |
121 | 121 | |
122 | - parse_str( sanitize_text_field( wp_unslash( $_POST['order'] ) ), $data ); |
|
122 | + parse_str(sanitize_text_field(wp_unslash($_POST['order'])), $data); |
|
123 | 123 | |
124 | - if ( ! is_array( $data ) ) { |
|
124 | + if ( ! is_array($data)) { |
|
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | |
128 | 128 | $id_arr = array(); |
129 | 129 | |
130 | - foreach ( $data as $key => $values ) { |
|
131 | - foreach ( $values as $position => $id ) { |
|
130 | + foreach ($data as $key => $values) { |
|
131 | + foreach ($values as $position => $id) { |
|
132 | 132 | $id_arr[] = $id; |
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | 136 | $menu_order_arr = array(); |
137 | 137 | |
138 | - foreach ( $id_arr as $key => $id ) { |
|
139 | - $results = $wpdb->get_results( "SELECT menu_order FROM $wpdb->posts WHERE ID = " . intval( $id ) ); |
|
138 | + foreach ($id_arr as $key => $id) { |
|
139 | + $results = $wpdb->get_results("SELECT menu_order FROM $wpdb->posts WHERE ID = " . intval($id)); |
|
140 | 140 | |
141 | - foreach ( $results as $result ) { |
|
141 | + foreach ($results as $result) { |
|
142 | 142 | $menu_order_arr[] = $result->menu_order; |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - sort( $menu_order_arr ); |
|
146 | + sort($menu_order_arr); |
|
147 | 147 | |
148 | - foreach ( $data as $key => $values ) { |
|
149 | - foreach ( $values as $position => $id ) { |
|
148 | + foreach ($data as $key => $values) { |
|
149 | + foreach ($values as $position => $id) { |
|
150 | 150 | $wpdb->update( |
151 | 151 | $wpdb->posts, |
152 | 152 | array( |
153 | - 'menu_order' => $menu_order_arr[ $position ], |
|
153 | + 'menu_order' => $menu_order_arr[$position], |
|
154 | 154 | ), |
155 | 155 | array( |
156 | - 'ID' => intval( $id ), |
|
156 | + 'ID' => intval($id), |
|
157 | 157 | ) |
158 | 158 | ); |
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - function lsx_projects_scporder_previous_post_where( $where ) { |
|
163 | + function lsx_projects_scporder_previous_post_where($where) { |
|
164 | 164 | global $post; |
165 | 165 | |
166 | 166 | $objects = $this->get_lsx_projects_scporder_options_objects(); |
167 | 167 | |
168 | - if ( empty( $objects ) ) { |
|
168 | + if (empty($objects)) { |
|
169 | 169 | return $where; |
170 | 170 | } |
171 | 171 | |
172 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
172 | + if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) { |
|
173 | 173 | $current_menu_order = $post->menu_order; |
174 | 174 | $where = "WHERE p.menu_order > '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'"; |
175 | 175 | } |
@@ -177,32 +177,32 @@ discard block |
||
177 | 177 | return $where; |
178 | 178 | } |
179 | 179 | |
180 | - function lsx_projects_scporder_previous_post_sort( $orderby ) { |
|
180 | + function lsx_projects_scporder_previous_post_sort($orderby) { |
|
181 | 181 | global $post; |
182 | 182 | |
183 | 183 | $objects = $this->get_lsx_projects_scporder_options_objects(); |
184 | 184 | |
185 | - if ( empty( $objects ) ) { |
|
185 | + if (empty($objects)) { |
|
186 | 186 | return $orderby; |
187 | 187 | } |
188 | 188 | |
189 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
189 | + if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) { |
|
190 | 190 | $orderby = 'ORDER BY p.menu_order ASC LIMIT 1'; |
191 | 191 | } |
192 | 192 | |
193 | 193 | return $orderby; |
194 | 194 | } |
195 | 195 | |
196 | - function lsx_projects_scporder_next_post_where( $where ) { |
|
196 | + function lsx_projects_scporder_next_post_where($where) { |
|
197 | 197 | global $post; |
198 | 198 | |
199 | 199 | $objects = $this->get_lsx_projects_scporder_options_objects(); |
200 | 200 | |
201 | - if ( empty( $objects ) ) { |
|
201 | + if (empty($objects)) { |
|
202 | 202 | return $where; |
203 | 203 | } |
204 | 204 | |
205 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
205 | + if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) { |
|
206 | 206 | $current_menu_order = $post->menu_order; |
207 | 207 | $where = "WHERE p.menu_order < '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'"; |
208 | 208 | } |
@@ -210,70 +210,70 @@ discard block |
||
210 | 210 | return $where; |
211 | 211 | } |
212 | 212 | |
213 | - function lsx_projects_scporder_next_post_sort( $orderby ) { |
|
213 | + function lsx_projects_scporder_next_post_sort($orderby) { |
|
214 | 214 | global $post; |
215 | 215 | |
216 | 216 | $objects = $this->get_lsx_projects_scporder_options_objects(); |
217 | 217 | |
218 | - if ( empty( $objects ) ) { |
|
218 | + if (empty($objects)) { |
|
219 | 219 | return $orderby; |
220 | 220 | } |
221 | 221 | |
222 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
222 | + if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) { |
|
223 | 223 | $orderby = 'ORDER BY p.menu_order DESC LIMIT 1'; |
224 | 224 | } |
225 | 225 | |
226 | 226 | return $orderby; |
227 | 227 | } |
228 | 228 | |
229 | - function lsx_projects_scporder_pre_get_posts( $wp_query ) { |
|
229 | + function lsx_projects_scporder_pre_get_posts($wp_query) { |
|
230 | 230 | $objects = $this->get_lsx_projects_scporder_options_objects(); |
231 | 231 | |
232 | - if ( empty( $objects ) ) { |
|
232 | + if (empty($objects)) { |
|
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | |
236 | - if ( is_admin() ) { |
|
237 | - if ( isset( $wp_query->query['post_type'] ) && ! isset( $_GET['orderby'] ) ) { |
|
238 | - if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) { |
|
239 | - $wp_query->set( 'orderby', 'menu_order' ); |
|
240 | - $wp_query->set( 'order', 'ASC' ); |
|
236 | + if (is_admin()) { |
|
237 | + if (isset($wp_query->query['post_type']) && ! isset($_GET['orderby'])) { |
|
238 | + if (array_key_exists($wp_query->query['post_type'], $objects)) { |
|
239 | + $wp_query->set('orderby', 'menu_order'); |
|
240 | + $wp_query->set('order', 'ASC'); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | } else { |
244 | 244 | $active = false; |
245 | 245 | |
246 | - if ( isset( $wp_query->query['post_type'] ) ) { |
|
247 | - if ( ! is_array( $wp_query->query['post_type'] ) ) { |
|
248 | - if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) { |
|
246 | + if (isset($wp_query->query['post_type'])) { |
|
247 | + if ( ! is_array($wp_query->query['post_type'])) { |
|
248 | + if (array_key_exists($wp_query->query['post_type'], $objects)) { |
|
249 | 249 | $active = true; |
250 | 250 | } |
251 | 251 | } |
252 | 252 | } else { |
253 | - if ( array_key_exists( 'post', $objects ) ) { |
|
253 | + if (array_key_exists('post', $objects)) { |
|
254 | 254 | $active = true; |
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | - if ( ! $active ) { |
|
258 | + if ( ! $active) { |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | |
262 | - if ( isset( $wp_query->query['suppress_filters'] ) ) { |
|
263 | - if ( $wp_query->get( 'orderby' ) == 'date' ) { |
|
264 | - $wp_query->set( 'orderby', 'menu_order' ); |
|
262 | + if (isset($wp_query->query['suppress_filters'])) { |
|
263 | + if ($wp_query->get('orderby') == 'date') { |
|
264 | + $wp_query->set('orderby', 'menu_order'); |
|
265 | 265 | } |
266 | 266 | |
267 | - if ( $wp_query->get( 'order' ) == 'DESC' ) { |
|
268 | - $wp_query->set( 'order', 'ASC' ); |
|
267 | + if ($wp_query->get('order') == 'DESC') { |
|
268 | + $wp_query->set('order', 'ASC'); |
|
269 | 269 | } |
270 | 270 | } else { |
271 | - if ( ! $wp_query->get( 'orderby' ) ) { |
|
272 | - $wp_query->set( 'orderby', 'menu_order' ); |
|
271 | + if ( ! $wp_query->get('orderby')) { |
|
272 | + $wp_query->set('orderby', 'menu_order'); |
|
273 | 273 | } |
274 | 274 | |
275 | - if ( ! $wp_query->get( 'order' ) ) { |
|
276 | - $wp_query->set( 'order', 'ASC' ); |
|
275 | + if ( ! $wp_query->get('order')) { |
|
276 | + $wp_query->set('order', 'ASC'); |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | function get_lsx_projects_scporder_options_objects() { |
283 | 283 | return array( |
284 | - 'project' => esc_html_x( 'Project', 'post type singular name', 'lsx-project' ), |
|
284 | + 'project' => esc_html_x('Project', 'post type singular name', 'lsx-project'), |
|
285 | 285 | ); |
286 | 286 | } |
287 | 287 | |
@@ -290,26 +290,26 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * SCP Order Uninstall hook |
292 | 292 | */ |
293 | -register_uninstall_hook( __FILE__, 'lsx_projects_scporder_uninstall' ); |
|
293 | +register_uninstall_hook(__FILE__, 'lsx_projects_scporder_uninstall'); |
|
294 | 294 | |
295 | 295 | function lsx_projects_scporder_uninstall() { |
296 | 296 | global $wpdb; |
297 | 297 | |
298 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
298 | + if (function_exists('is_multisite') && is_multisite()) { |
|
299 | 299 | $curr_blog = $wpdb->blogid; |
300 | - $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
300 | + $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); |
|
301 | 301 | |
302 | - foreach ( $blogids as $blog_id ) { |
|
303 | - switch_to_blog( $blog_id ); |
|
302 | + foreach ($blogids as $blog_id) { |
|
303 | + switch_to_blog($blog_id); |
|
304 | 304 | lsx_projects_scporder_uninstall_db(); |
305 | 305 | } |
306 | 306 | |
307 | - switch_to_blog( $curr_blog ); |
|
307 | + switch_to_blog($curr_blog); |
|
308 | 308 | } else { |
309 | 309 | lsx_projects_scporder_uninstall_db(); |
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
313 | 313 | function lsx_projects_scporder_uninstall_db() { |
314 | - delete_option( 'lsx_projects_scporder_install' ); |
|
314 | + delete_option('lsx_projects_scporder_install'); |
|
315 | 315 | } |
@@ -13,277 +13,277 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class LSX_Projects_SCPO_Engine { |
15 | 15 | |
16 | - function __construct() { |
|
17 | - if ( ! get_option( 'lsx_projects_scporder_install' ) ) { |
|
18 | - $this->lsx_projects_scporder_install(); |
|
19 | - } |
|
16 | + function __construct() { |
|
17 | + if ( ! get_option( 'lsx_projects_scporder_install' ) ) { |
|
18 | + $this->lsx_projects_scporder_install(); |
|
19 | + } |
|
20 | 20 | |
21 | - add_action( 'admin_init', array( $this, 'refresh' ) ); |
|
22 | - add_action( 'admin_init', array( $this, 'load_script_css' ) ); |
|
21 | + add_action( 'admin_init', array( $this, 'refresh' ) ); |
|
22 | + add_action( 'admin_init', array( $this, 'load_script_css' ) ); |
|
23 | 23 | |
24 | - add_action( 'wp_ajax_update-menu-order', array( $this, 'update_menu_order' ) ); |
|
24 | + add_action( 'wp_ajax_update-menu-order', array( $this, 'update_menu_order' ) ); |
|
25 | 25 | |
26 | - add_action( 'pre_get_posts', array( $this, 'lsx_projects_scporder_pre_get_posts' ) ); |
|
26 | + add_action( 'pre_get_posts', array( $this, 'lsx_projects_scporder_pre_get_posts' ) ); |
|
27 | 27 | |
28 | - add_filter( 'get_previous_post_where', array( $this, 'lsx_projects_scporder_previous_post_where' ) ); |
|
29 | - add_filter( 'get_previous_post_sort', array( $this, 'lsx_projects_scporder_previous_post_sort' ) ); |
|
30 | - add_filter( 'get_next_post_where', array( $this, 'lsx_projects_scporder_next_post_where' ) ); |
|
31 | - add_filter( 'get_next_post_sort', array( $this, 'lsx_projects_scporder_next_post_sort' ) ); |
|
32 | - } |
|
28 | + add_filter( 'get_previous_post_where', array( $this, 'lsx_projects_scporder_previous_post_where' ) ); |
|
29 | + add_filter( 'get_previous_post_sort', array( $this, 'lsx_projects_scporder_previous_post_sort' ) ); |
|
30 | + add_filter( 'get_next_post_where', array( $this, 'lsx_projects_scporder_next_post_where' ) ); |
|
31 | + add_filter( 'get_next_post_sort', array( $this, 'lsx_projects_scporder_next_post_sort' ) ); |
|
32 | + } |
|
33 | 33 | |
34 | - function lsx_projects_scporder_install() { |
|
35 | - update_option( 'lsx_projects_scporder_install', 1 ); |
|
36 | - } |
|
34 | + function lsx_projects_scporder_install() { |
|
35 | + update_option( 'lsx_projects_scporder_install', 1 ); |
|
36 | + } |
|
37 | 37 | |
38 | - function _check_load_script_css() { |
|
39 | - $active = false; |
|
40 | - $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
38 | + function _check_load_script_css() { |
|
39 | + $active = false; |
|
40 | + $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
41 | 41 | |
42 | - if ( empty( $objects ) ) { |
|
43 | - return false; |
|
44 | - } |
|
42 | + if ( empty( $objects ) ) { |
|
43 | + return false; |
|
44 | + } |
|
45 | 45 | |
46 | - if ( isset( $_GET['orderby'] ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'action=edit' ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/post-new.php' ) ) { |
|
47 | - return false; |
|
48 | - } |
|
46 | + if ( isset( $_GET['orderby'] ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'action=edit' ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/post-new.php' ) ) { |
|
47 | + return false; |
|
48 | + } |
|
49 | 49 | |
50 | - if ( ! empty( $objects ) ) { |
|
51 | - if ( isset( $_GET['post_type'] ) && ! isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_GET['post_type'] ) ), $objects ) ) { // if page or custom post types |
|
52 | - $active = true; |
|
53 | - } |
|
50 | + if ( ! empty( $objects ) ) { |
|
51 | + if ( isset( $_GET['post_type'] ) && ! isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_GET['post_type'] ) ), $objects ) ) { // if page or custom post types |
|
52 | + $active = true; |
|
53 | + } |
|
54 | 54 | |
55 | - if ( ! isset( $_GET['post_type'] ) && strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/edit.php' ) && array_key_exists( 'post', $objects ) ) { // if post |
|
56 | - $active = true; |
|
57 | - } |
|
58 | - } |
|
55 | + if ( ! isset( $_GET['post_type'] ) && strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/edit.php' ) && array_key_exists( 'post', $objects ) ) { // if post |
|
56 | + $active = true; |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | - return $active; |
|
61 | - } |
|
60 | + return $active; |
|
61 | + } |
|
62 | 62 | |
63 | - function load_script_css() { |
|
64 | - if ( $this->_check_load_script_css() ) { |
|
65 | - wp_enqueue_script( 'scporderjs', LSX_PROJECTS_URL . 'assets/js/scporder.min.js', array( 'jquery', 'jquery-ui-sortable' ), null, true ); |
|
63 | + function load_script_css() { |
|
64 | + if ( $this->_check_load_script_css() ) { |
|
65 | + wp_enqueue_script( 'scporderjs', LSX_PROJECTS_URL . 'assets/js/scporder.min.js', array( 'jquery', 'jquery-ui-sortable' ), null, true ); |
|
66 | 66 | |
67 | - $scporderjs_params = array( |
|
68 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
69 | - 'ajax_nonce' => wp_create_nonce( 'scporder' ), |
|
70 | - ); |
|
67 | + $scporderjs_params = array( |
|
68 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
69 | + 'ajax_nonce' => wp_create_nonce( 'scporder' ), |
|
70 | + ); |
|
71 | 71 | |
72 | - wp_localize_script( 'scporderjs', 'scporderjs_params', $scporderjs_params ); |
|
72 | + wp_localize_script( 'scporderjs', 'scporderjs_params', $scporderjs_params ); |
|
73 | 73 | |
74 | - wp_enqueue_style( 'scporder', LSX_PROJECTS_URL . 'assets/css/scporder.css', array(), null ); |
|
75 | - } |
|
76 | - } |
|
74 | + wp_enqueue_style( 'scporder', LSX_PROJECTS_URL . 'assets/css/scporder.css', array(), null ); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - function refresh() { |
|
79 | - global $wpdb; |
|
78 | + function refresh() { |
|
79 | + global $wpdb; |
|
80 | 80 | |
81 | - $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
81 | + $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
82 | 82 | |
83 | - if ( ! empty( $objects ) ) { |
|
84 | - foreach ( $objects as $object => $object_data ) { |
|
85 | - $result = $wpdb->get_results($wpdb->prepare(" |
|
83 | + if ( ! empty( $objects ) ) { |
|
84 | + foreach ( $objects as $object => $object_data ) { |
|
85 | + $result = $wpdb->get_results($wpdb->prepare(" |
|
86 | 86 | SELECT count(*) as cnt, max(menu_order) as max, min(menu_order) as min |
87 | 87 | FROM $wpdb->posts |
88 | 88 | WHERE post_type = '%s' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future') |
89 | 89 | ", $object)); |
90 | 90 | |
91 | - if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) { |
|
92 | - continue; |
|
93 | - } |
|
91 | + if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) { |
|
92 | + continue; |
|
93 | + } |
|
94 | 94 | |
95 | - $results = $wpdb->get_results( $wpdb->prepare(" |
|
95 | + $results = $wpdb->get_results( $wpdb->prepare(" |
|
96 | 96 | SELECT ID |
97 | 97 | FROM $wpdb->posts |
98 | 98 | WHERE post_type = '%s' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future') |
99 | 99 | ORDER BY menu_order ASC |
100 | 100 | ", $object ) ); |
101 | 101 | |
102 | - foreach ( $results as $key => $result ) { |
|
103 | - $wpdb->update( |
|
104 | - $wpdb->posts, |
|
105 | - array( |
|
106 | - 'menu_order' => $key + 1, |
|
107 | - ), |
|
108 | - array( |
|
109 | - 'ID' => $result->ID, |
|
110 | - ) |
|
111 | - ); |
|
112 | - } |
|
113 | - } |
|
114 | - } |
|
115 | - } |
|
102 | + foreach ( $results as $key => $result ) { |
|
103 | + $wpdb->update( |
|
104 | + $wpdb->posts, |
|
105 | + array( |
|
106 | + 'menu_order' => $key + 1, |
|
107 | + ), |
|
108 | + array( |
|
109 | + 'ID' => $result->ID, |
|
110 | + ) |
|
111 | + ); |
|
112 | + } |
|
113 | + } |
|
114 | + } |
|
115 | + } |
|
116 | 116 | |
117 | - function update_menu_order() { |
|
118 | - check_ajax_referer( 'scporder', 'security' ); |
|
117 | + function update_menu_order() { |
|
118 | + check_ajax_referer( 'scporder', 'security' ); |
|
119 | 119 | |
120 | - global $wpdb; |
|
120 | + global $wpdb; |
|
121 | 121 | |
122 | - parse_str( sanitize_text_field( wp_unslash( $_POST['order'] ) ), $data ); |
|
122 | + parse_str( sanitize_text_field( wp_unslash( $_POST['order'] ) ), $data ); |
|
123 | 123 | |
124 | - if ( ! is_array( $data ) ) { |
|
125 | - return false; |
|
126 | - } |
|
124 | + if ( ! is_array( $data ) ) { |
|
125 | + return false; |
|
126 | + } |
|
127 | 127 | |
128 | - $id_arr = array(); |
|
128 | + $id_arr = array(); |
|
129 | 129 | |
130 | - foreach ( $data as $key => $values ) { |
|
131 | - foreach ( $values as $position => $id ) { |
|
132 | - $id_arr[] = $id; |
|
133 | - } |
|
134 | - } |
|
130 | + foreach ( $data as $key => $values ) { |
|
131 | + foreach ( $values as $position => $id ) { |
|
132 | + $id_arr[] = $id; |
|
133 | + } |
|
134 | + } |
|
135 | 135 | |
136 | - $menu_order_arr = array(); |
|
136 | + $menu_order_arr = array(); |
|
137 | 137 | |
138 | - foreach ( $id_arr as $key => $id ) { |
|
139 | - $results = $wpdb->get_results( "SELECT menu_order FROM $wpdb->posts WHERE ID = " . intval( $id ) ); |
|
138 | + foreach ( $id_arr as $key => $id ) { |
|
139 | + $results = $wpdb->get_results( "SELECT menu_order FROM $wpdb->posts WHERE ID = " . intval( $id ) ); |
|
140 | 140 | |
141 | - foreach ( $results as $result ) { |
|
142 | - $menu_order_arr[] = $result->menu_order; |
|
143 | - } |
|
144 | - } |
|
141 | + foreach ( $results as $result ) { |
|
142 | + $menu_order_arr[] = $result->menu_order; |
|
143 | + } |
|
144 | + } |
|
145 | 145 | |
146 | - sort( $menu_order_arr ); |
|
146 | + sort( $menu_order_arr ); |
|
147 | 147 | |
148 | - foreach ( $data as $key => $values ) { |
|
149 | - foreach ( $values as $position => $id ) { |
|
150 | - $wpdb->update( |
|
151 | - $wpdb->posts, |
|
152 | - array( |
|
153 | - 'menu_order' => $menu_order_arr[ $position ], |
|
154 | - ), |
|
155 | - array( |
|
156 | - 'ID' => intval( $id ), |
|
157 | - ) |
|
158 | - ); |
|
159 | - } |
|
160 | - } |
|
161 | - } |
|
162 | - |
|
163 | - function lsx_projects_scporder_previous_post_where( $where ) { |
|
164 | - global $post; |
|
165 | - |
|
166 | - $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
167 | - |
|
168 | - if ( empty( $objects ) ) { |
|
169 | - return $where; |
|
170 | - } |
|
171 | - |
|
172 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
173 | - $current_menu_order = $post->menu_order; |
|
174 | - $where = "WHERE p.menu_order > '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'"; |
|
175 | - } |
|
176 | - |
|
177 | - return $where; |
|
178 | - } |
|
179 | - |
|
180 | - function lsx_projects_scporder_previous_post_sort( $orderby ) { |
|
181 | - global $post; |
|
182 | - |
|
183 | - $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
184 | - |
|
185 | - if ( empty( $objects ) ) { |
|
186 | - return $orderby; |
|
187 | - } |
|
188 | - |
|
189 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
190 | - $orderby = 'ORDER BY p.menu_order ASC LIMIT 1'; |
|
191 | - } |
|
192 | - |
|
193 | - return $orderby; |
|
194 | - } |
|
195 | - |
|
196 | - function lsx_projects_scporder_next_post_where( $where ) { |
|
197 | - global $post; |
|
198 | - |
|
199 | - $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
200 | - |
|
201 | - if ( empty( $objects ) ) { |
|
202 | - return $where; |
|
203 | - } |
|
204 | - |
|
205 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
206 | - $current_menu_order = $post->menu_order; |
|
207 | - $where = "WHERE p.menu_order < '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'"; |
|
208 | - } |
|
209 | - |
|
210 | - return $where; |
|
211 | - } |
|
212 | - |
|
213 | - function lsx_projects_scporder_next_post_sort( $orderby ) { |
|
214 | - global $post; |
|
215 | - |
|
216 | - $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
217 | - |
|
218 | - if ( empty( $objects ) ) { |
|
219 | - return $orderby; |
|
220 | - } |
|
221 | - |
|
222 | - if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
223 | - $orderby = 'ORDER BY p.menu_order DESC LIMIT 1'; |
|
224 | - } |
|
225 | - |
|
226 | - return $orderby; |
|
227 | - } |
|
228 | - |
|
229 | - function lsx_projects_scporder_pre_get_posts( $wp_query ) { |
|
230 | - $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
231 | - |
|
232 | - if ( empty( $objects ) ) { |
|
233 | - return false; |
|
234 | - } |
|
235 | - |
|
236 | - if ( is_admin() ) { |
|
237 | - if ( isset( $wp_query->query['post_type'] ) && ! isset( $_GET['orderby'] ) ) { |
|
238 | - if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) { |
|
239 | - $wp_query->set( 'orderby', 'menu_order' ); |
|
240 | - $wp_query->set( 'order', 'ASC' ); |
|
241 | - } |
|
242 | - } |
|
243 | - } else { |
|
244 | - $active = false; |
|
245 | - |
|
246 | - if ( isset( $wp_query->query['post_type'] ) ) { |
|
247 | - if ( ! is_array( $wp_query->query['post_type'] ) ) { |
|
248 | - if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) { |
|
249 | - $active = true; |
|
250 | - } |
|
251 | - } |
|
252 | - } else { |
|
253 | - if ( array_key_exists( 'post', $objects ) ) { |
|
254 | - $active = true; |
|
255 | - } |
|
256 | - } |
|
257 | - |
|
258 | - if ( ! $active ) { |
|
259 | - return false; |
|
260 | - } |
|
261 | - |
|
262 | - if ( isset( $wp_query->query['suppress_filters'] ) ) { |
|
263 | - if ( $wp_query->get( 'orderby' ) == 'date' ) { |
|
264 | - $wp_query->set( 'orderby', 'menu_order' ); |
|
265 | - } |
|
266 | - |
|
267 | - if ( $wp_query->get( 'order' ) == 'DESC' ) { |
|
268 | - $wp_query->set( 'order', 'ASC' ); |
|
269 | - } |
|
270 | - } else { |
|
271 | - if ( ! $wp_query->get( 'orderby' ) ) { |
|
272 | - $wp_query->set( 'orderby', 'menu_order' ); |
|
273 | - } |
|
274 | - |
|
275 | - if ( ! $wp_query->get( 'order' ) ) { |
|
276 | - $wp_query->set( 'order', 'ASC' ); |
|
277 | - } |
|
278 | - } |
|
279 | - } |
|
280 | - } |
|
281 | - |
|
282 | - function get_lsx_projects_scporder_options_objects() { |
|
283 | - return array( |
|
284 | - 'project' => esc_html_x( 'Project', 'post type singular name', 'lsx-project' ), |
|
285 | - ); |
|
286 | - } |
|
148 | + foreach ( $data as $key => $values ) { |
|
149 | + foreach ( $values as $position => $id ) { |
|
150 | + $wpdb->update( |
|
151 | + $wpdb->posts, |
|
152 | + array( |
|
153 | + 'menu_order' => $menu_order_arr[ $position ], |
|
154 | + ), |
|
155 | + array( |
|
156 | + 'ID' => intval( $id ), |
|
157 | + ) |
|
158 | + ); |
|
159 | + } |
|
160 | + } |
|
161 | + } |
|
162 | + |
|
163 | + function lsx_projects_scporder_previous_post_where( $where ) { |
|
164 | + global $post; |
|
165 | + |
|
166 | + $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
167 | + |
|
168 | + if ( empty( $objects ) ) { |
|
169 | + return $where; |
|
170 | + } |
|
171 | + |
|
172 | + if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
173 | + $current_menu_order = $post->menu_order; |
|
174 | + $where = "WHERE p.menu_order > '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'"; |
|
175 | + } |
|
176 | + |
|
177 | + return $where; |
|
178 | + } |
|
179 | + |
|
180 | + function lsx_projects_scporder_previous_post_sort( $orderby ) { |
|
181 | + global $post; |
|
182 | + |
|
183 | + $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
184 | + |
|
185 | + if ( empty( $objects ) ) { |
|
186 | + return $orderby; |
|
187 | + } |
|
188 | + |
|
189 | + if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
190 | + $orderby = 'ORDER BY p.menu_order ASC LIMIT 1'; |
|
191 | + } |
|
192 | + |
|
193 | + return $orderby; |
|
194 | + } |
|
195 | + |
|
196 | + function lsx_projects_scporder_next_post_where( $where ) { |
|
197 | + global $post; |
|
198 | + |
|
199 | + $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
200 | + |
|
201 | + if ( empty( $objects ) ) { |
|
202 | + return $where; |
|
203 | + } |
|
204 | + |
|
205 | + if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
206 | + $current_menu_order = $post->menu_order; |
|
207 | + $where = "WHERE p.menu_order < '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'"; |
|
208 | + } |
|
209 | + |
|
210 | + return $where; |
|
211 | + } |
|
212 | + |
|
213 | + function lsx_projects_scporder_next_post_sort( $orderby ) { |
|
214 | + global $post; |
|
215 | + |
|
216 | + $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
217 | + |
|
218 | + if ( empty( $objects ) ) { |
|
219 | + return $orderby; |
|
220 | + } |
|
221 | + |
|
222 | + if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) { |
|
223 | + $orderby = 'ORDER BY p.menu_order DESC LIMIT 1'; |
|
224 | + } |
|
225 | + |
|
226 | + return $orderby; |
|
227 | + } |
|
228 | + |
|
229 | + function lsx_projects_scporder_pre_get_posts( $wp_query ) { |
|
230 | + $objects = $this->get_lsx_projects_scporder_options_objects(); |
|
231 | + |
|
232 | + if ( empty( $objects ) ) { |
|
233 | + return false; |
|
234 | + } |
|
235 | + |
|
236 | + if ( is_admin() ) { |
|
237 | + if ( isset( $wp_query->query['post_type'] ) && ! isset( $_GET['orderby'] ) ) { |
|
238 | + if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) { |
|
239 | + $wp_query->set( 'orderby', 'menu_order' ); |
|
240 | + $wp_query->set( 'order', 'ASC' ); |
|
241 | + } |
|
242 | + } |
|
243 | + } else { |
|
244 | + $active = false; |
|
245 | + |
|
246 | + if ( isset( $wp_query->query['post_type'] ) ) { |
|
247 | + if ( ! is_array( $wp_query->query['post_type'] ) ) { |
|
248 | + if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) { |
|
249 | + $active = true; |
|
250 | + } |
|
251 | + } |
|
252 | + } else { |
|
253 | + if ( array_key_exists( 'post', $objects ) ) { |
|
254 | + $active = true; |
|
255 | + } |
|
256 | + } |
|
257 | + |
|
258 | + if ( ! $active ) { |
|
259 | + return false; |
|
260 | + } |
|
261 | + |
|
262 | + if ( isset( $wp_query->query['suppress_filters'] ) ) { |
|
263 | + if ( $wp_query->get( 'orderby' ) == 'date' ) { |
|
264 | + $wp_query->set( 'orderby', 'menu_order' ); |
|
265 | + } |
|
266 | + |
|
267 | + if ( $wp_query->get( 'order' ) == 'DESC' ) { |
|
268 | + $wp_query->set( 'order', 'ASC' ); |
|
269 | + } |
|
270 | + } else { |
|
271 | + if ( ! $wp_query->get( 'orderby' ) ) { |
|
272 | + $wp_query->set( 'orderby', 'menu_order' ); |
|
273 | + } |
|
274 | + |
|
275 | + if ( ! $wp_query->get( 'order' ) ) { |
|
276 | + $wp_query->set( 'order', 'ASC' ); |
|
277 | + } |
|
278 | + } |
|
279 | + } |
|
280 | + } |
|
281 | + |
|
282 | + function get_lsx_projects_scporder_options_objects() { |
|
283 | + return array( |
|
284 | + 'project' => esc_html_x( 'Project', 'post type singular name', 'lsx-project' ), |
|
285 | + ); |
|
286 | + } |
|
287 | 287 | |
288 | 288 | } |
289 | 289 | |
@@ -293,23 +293,23 @@ discard block |
||
293 | 293 | register_uninstall_hook( __FILE__, 'lsx_projects_scporder_uninstall' ); |
294 | 294 | |
295 | 295 | function lsx_projects_scporder_uninstall() { |
296 | - global $wpdb; |
|
296 | + global $wpdb; |
|
297 | 297 | |
298 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
299 | - $curr_blog = $wpdb->blogid; |
|
300 | - $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
298 | + if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
299 | + $curr_blog = $wpdb->blogid; |
|
300 | + $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
301 | 301 | |
302 | - foreach ( $blogids as $blog_id ) { |
|
303 | - switch_to_blog( $blog_id ); |
|
304 | - lsx_projects_scporder_uninstall_db(); |
|
305 | - } |
|
302 | + foreach ( $blogids as $blog_id ) { |
|
303 | + switch_to_blog( $blog_id ); |
|
304 | + lsx_projects_scporder_uninstall_db(); |
|
305 | + } |
|
306 | 306 | |
307 | - switch_to_blog( $curr_blog ); |
|
308 | - } else { |
|
309 | - lsx_projects_scporder_uninstall_db(); |
|
310 | - } |
|
307 | + switch_to_blog( $curr_blog ); |
|
308 | + } else { |
|
309 | + lsx_projects_scporder_uninstall_db(); |
|
310 | + } |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | function lsx_projects_scporder_uninstall_db() { |
314 | - delete_option( 'lsx_projects_scporder_install' ); |
|
314 | + delete_option( 'lsx_projects_scporder_install' ); |
|
315 | 315 | } |
@@ -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 | - <?php while ( have_posts() ) : the_post(); ?> |
|
22 | + <?php while (have_posts()) : the_post(); ?> |
|
23 | 23 | |
24 | - <?php include( LSX_PROJECTS_PATH . '/templates/content-single-projects.php' ); ?> |
|
24 | + <?php include(LSX_PROJECTS_PATH . '/templates/content-single-projects.php'); ?> |
|
25 | 25 | |
26 | 26 | <?php endwhile; ?> |
27 | 27 |
@@ -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 | |
@@ -23,33 +23,33 @@ discard block |
||
23 | 23 | 'hide_empty' => false, |
24 | 24 | ); |
25 | 25 | |
26 | - $groups = get_terms( $args ); |
|
27 | - $group_selected = get_query_var( 'project-group' ); |
|
26 | + $groups = get_terms($args); |
|
27 | + $group_selected = get_query_var('project-group'); |
|
28 | 28 | |
29 | - if ( count( $groups ) > 0 ) : |
|
29 | + if (count($groups) > 0) : |
|
30 | 30 | ?> |
31 | 31 | |
32 | 32 | <ul class="nav nav-tabs lsx-projects-filter"> |
33 | 33 | <?php |
34 | 34 | $group_selected_class = ''; |
35 | 35 | |
36 | - if ( empty( $group_selected ) ) { |
|
36 | + if (empty($group_selected)) { |
|
37 | 37 | $group_selected_class = ' class="active"'; |
38 | 38 | } |
39 | 39 | ?> |
40 | 40 | |
41 | - <li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'project' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-projects' ); ?></a></li> |
|
41 | + <li<?php echo wp_kses_post($group_selected_class); ?>><a href="<?php echo empty($group_selected) ? '#' : esc_url(get_post_type_archive_link('project')); ?>" data-filter="*"><?php esc_html_e('All', 'lsx-projects'); ?></a></li> |
|
42 | 42 | |
43 | - <?php foreach ( $groups as $group ) : ?> |
|
43 | + <?php foreach ($groups as $group) : ?> |
|
44 | 44 | <?php |
45 | 45 | $group_selected_class = ''; |
46 | 46 | |
47 | - if ( (string) $group_selected === (string) $group->slug ) { |
|
47 | + if ((string) $group_selected === (string) $group->slug) { |
|
48 | 48 | $group_selected_class = ' class="active"'; |
49 | 49 | } |
50 | 50 | ?> |
51 | 51 | |
52 | - <li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_term_link( $group ) ); ?>" data-filter=".filter-<?php echo esc_attr( $group->slug ); ?>"><?php echo esc_attr( $group->name ); ?></a></li> |
|
52 | + <li<?php echo wp_kses_post($group_selected_class); ?>><a href="<?php echo empty($group_selected) ? '#' : esc_url(get_term_link($group)); ?>" data-filter=".filter-<?php echo esc_attr($group->slug); ?>"><?php echo esc_attr($group->name); ?></a></li> |
|
53 | 53 | <?php endforeach; ?> |
54 | 54 | </ul> |
55 | 55 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | endif; |
58 | 58 | ?> |
59 | 59 | |
60 | - <?php if ( have_posts() ) : ?> |
|
60 | + <?php if (have_posts()) : ?> |
|
61 | 61 | |
62 | 62 | <div class="lsx-projects-container"> |
63 | 63 | <div class="row row-flex lsx-projects-row""> |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | <?php |
66 | 66 | $count = 0; |
67 | 67 | |
68 | - while ( have_posts() ) { |
|
68 | + while (have_posts()) { |
|
69 | 69 | the_post(); |
70 | - include( LSX_PROJECTS_PATH . '/templates/content-archive-projects.php' ); |
|
70 | + include(LSX_PROJECTS_PATH . '/templates/content-archive-projects.php'); |
|
71 | 71 | } |
72 | 72 | ?> |
73 | 73 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | <?php else : ?> |
80 | 80 | |
81 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
81 | + <?php get_template_part('partials/content', 'none'); ?> |
|
82 | 82 | |
83 | 83 | <?php endif; ?> |
84 | 84 |
@@ -18,44 +18,44 @@ discard block |
||
18 | 18 | <?php lsx_content_top(); ?> |
19 | 19 | |
20 | 20 | <?php |
21 | - $args = array( |
|
22 | - 'taxonomy' => 'project-group', |
|
23 | - 'hide_empty' => false, |
|
24 | - ); |
|
21 | + $args = array( |
|
22 | + 'taxonomy' => 'project-group', |
|
23 | + 'hide_empty' => false, |
|
24 | + ); |
|
25 | 25 | |
26 | - $groups = get_terms( $args ); |
|
27 | - $group_selected = get_query_var( 'project-group' ); |
|
26 | + $groups = get_terms( $args ); |
|
27 | + $group_selected = get_query_var( 'project-group' ); |
|
28 | 28 | |
29 | - if ( count( $groups ) > 0 ) : |
|
30 | - ?> |
|
29 | + if ( count( $groups ) > 0 ) : |
|
30 | + ?> |
|
31 | 31 | |
32 | 32 | <ul class="nav nav-tabs lsx-projects-filter"> |
33 | 33 | <?php |
34 | - $group_selected_class = ''; |
|
34 | + $group_selected_class = ''; |
|
35 | 35 | |
36 | - if ( empty( $group_selected ) ) { |
|
37 | - $group_selected_class = ' class="active"'; |
|
38 | - } |
|
39 | - ?> |
|
36 | + if ( empty( $group_selected ) ) { |
|
37 | + $group_selected_class = ' class="active"'; |
|
38 | + } |
|
39 | + ?> |
|
40 | 40 | |
41 | 41 | <li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'project' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-projects' ); ?></a></li> |
42 | 42 | |
43 | 43 | <?php foreach ( $groups as $group ) : ?> |
44 | 44 | <?php |
45 | - $group_selected_class = ''; |
|
45 | + $group_selected_class = ''; |
|
46 | 46 | |
47 | - if ( (string) $group_selected === (string) $group->slug ) { |
|
48 | - $group_selected_class = ' class="active"'; |
|
49 | - } |
|
50 | - ?> |
|
47 | + if ( (string) $group_selected === (string) $group->slug ) { |
|
48 | + $group_selected_class = ' class="active"'; |
|
49 | + } |
|
50 | + ?> |
|
51 | 51 | |
52 | 52 | <li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_term_link( $group ) ); ?>" data-filter=".filter-<?php echo esc_attr( $group->slug ); ?>"><?php echo esc_attr( $group->name ); ?></a></li> |
53 | 53 | <?php endforeach; ?> |
54 | 54 | </ul> |
55 | 55 | |
56 | 56 | <?php |
57 | - endif; |
|
58 | - ?> |
|
57 | + endif; |
|
58 | + ?> |
|
59 | 59 | |
60 | 60 | <?php if ( have_posts() ) : ?> |
61 | 61 | |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | <div class="row row-flex lsx-projects-row""> |
64 | 64 | |
65 | 65 | <?php |
66 | - $count = 0; |
|
66 | + $count = 0; |
|
67 | 67 | |
68 | - while ( have_posts() ) { |
|
69 | - the_post(); |
|
70 | - include( LSX_PROJECTS_PATH . '/templates/content-archive-projects.php' ); |
|
71 | - } |
|
72 | - ?> |
|
68 | + while ( have_posts() ) { |
|
69 | + the_post(); |
|
70 | + include( LSX_PROJECTS_PATH . '/templates/content-archive-projects.php' ); |
|
71 | + } |
|
72 | + ?> |
|
73 | 73 | |
74 | 74 | </div> |
75 | 75 | </div> |
@@ -76,9 +76,12 @@ |
||
76 | 76 | |
77 | 77 | <?php lsx_paging_nav(); ?> |
78 | 78 | |
79 | - <?php else : ?> |
|
79 | + <?php else { |
|
80 | + : ?> |
|
80 | 81 | |
81 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
82 | + <?php get_template_part( 'partials/content', 'none' ); |
|
83 | +} |
|
84 | +?> |
|
82 | 85 | |
83 | 86 | <?php endif; ?> |
84 | 87 |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | 'classname' => 'lsx-projects', |
16 | 16 | ); |
17 | 17 | |
18 | - parent::__construct( 'LSX_Projects_Widget', esc_html__( 'LSX Projects', 'lsx-projects' ), $widget_ops ); |
|
18 | + parent::__construct('LSX_Projects_Widget', esc_html__('LSX Projects', 'lsx-projects'), $widget_ops); |
|
19 | 19 | } |
20 | 20 | |
21 | - function widget( $args, $instance ) { |
|
22 | - extract( $args ); |
|
21 | + function widget($args, $instance) { |
|
22 | + extract($args); |
|
23 | 23 | |
24 | 24 | $title = $instance['title']; |
25 | 25 | $title_link = $instance['title_link']; |
@@ -38,40 +38,40 @@ discard block |
||
38 | 38 | $featured = $instance['featured']; |
39 | 39 | |
40 | 40 | // If limit not set, display 99 posts |
41 | - if ( empty( $limit ) ) { |
|
41 | + if (empty($limit)) { |
|
42 | 42 | $limit = '99'; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // If specific posts included, display 99 posts |
46 | - if ( ! empty( $include ) ) { |
|
46 | + if ( ! empty($include)) { |
|
47 | 47 | $limit = '99'; |
48 | 48 | } |
49 | 49 | |
50 | - if ( '1' == $responsive ) { |
|
50 | + if ('1' == $responsive) { |
|
51 | 51 | $responsive = 'true'; |
52 | 52 | } else { |
53 | 53 | $responsive = 'false'; |
54 | 54 | } |
55 | 55 | |
56 | - if ( '1' == $show_image ) { |
|
56 | + if ('1' == $show_image) { |
|
57 | 57 | $show_image = 'true'; |
58 | 58 | } else { |
59 | 59 | $show_image = 'false'; |
60 | 60 | } |
61 | 61 | |
62 | - if ( '1' == $carousel ) { |
|
62 | + if ('1' == $carousel) { |
|
63 | 63 | $carousel = 'true'; |
64 | 64 | } else { |
65 | 65 | $carousel = 'false'; |
66 | 66 | } |
67 | 67 | |
68 | - if ( '1' == $featured ) { |
|
68 | + if ('1' == $featured) { |
|
69 | 69 | $featured = 'true'; |
70 | 70 | } else { |
71 | 71 | $featured = 'false'; |
72 | 72 | } |
73 | 73 | |
74 | - if ( $title_link ) { |
|
74 | + if ($title_link) { |
|
75 | 75 | //$link_open = '<a href="' . $title_link . '">'; |
76 | 76 | $link_open = ''; |
77 | 77 | $link_btn_open = '<a href="' . $title_link . '" class="btn border-btn">'; |
@@ -85,18 +85,18 @@ discard block |
||
85 | 85 | $link_btn_close = ''; |
86 | 86 | } |
87 | 87 | |
88 | - echo wp_kses_post( $before_widget ); |
|
88 | + echo wp_kses_post($before_widget); |
|
89 | 89 | |
90 | - if ( $title ) { |
|
91 | - echo wp_kses_post( $before_title . $link_open . $title . $link_close . $after_title ); |
|
90 | + if ($title) { |
|
91 | + echo wp_kses_post($before_title . $link_open . $title . $link_close . $after_title); |
|
92 | 92 | } |
93 | 93 | |
94 | - if ( $tagline ) { |
|
95 | - echo '<p class="tagline text-center">' . esc_html( $tagline ) . '</p>'; |
|
94 | + if ($tagline) { |
|
95 | + echo '<p class="tagline text-center">' . esc_html($tagline) . '</p>'; |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( class_exists( 'LSX_Projects' ) ) { |
|
99 | - lsx_projects( array( |
|
98 | + if (class_exists('LSX_Projects')) { |
|
99 | + lsx_projects(array( |
|
100 | 100 | 'columns' => $columns, |
101 | 101 | 'orderby' => $orderby, |
102 | 102 | 'order' => $order, |
@@ -108,39 +108,39 @@ discard block |
||
108 | 108 | 'show_image' => $show_image, |
109 | 109 | 'carousel' => $carousel, |
110 | 110 | 'featured' => $featured, |
111 | - ) ); |
|
111 | + )); |
|
112 | 112 | }; |
113 | 113 | |
114 | - if ( $button_text && $title_link ) { |
|
115 | - echo wp_kses_post( '<p class="text-center lsx-projects-archive-link-wrap"><span class="lsx-projects-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>' ); |
|
114 | + if ($button_text && $title_link) { |
|
115 | + echo wp_kses_post('<p class="text-center lsx-projects-archive-link-wrap"><span class="lsx-projects-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>'); |
|
116 | 116 | } |
117 | 117 | |
118 | - echo wp_kses_post( $after_widget ); |
|
118 | + echo wp_kses_post($after_widget); |
|
119 | 119 | } |
120 | 120 | |
121 | - function update( $new_instance, $old_instance ) { |
|
121 | + function update($new_instance, $old_instance) { |
|
122 | 122 | $instance = $old_instance; |
123 | 123 | |
124 | - $instance['title'] = wp_kses_post( force_balance_tags( $new_instance['title'] ) ); |
|
125 | - $instance['title_link'] = strip_tags( $new_instance['title_link'] ); |
|
126 | - $instance['tagline'] = wp_kses_post( force_balance_tags( $new_instance['tagline'] ) ); |
|
127 | - $instance['columns'] = strip_tags( $new_instance['columns'] ); |
|
128 | - $instance['orderby'] = strip_tags( $new_instance['orderby'] ); |
|
129 | - $instance['order'] = strip_tags( $new_instance['order'] ); |
|
130 | - $instance['limit'] = strip_tags( $new_instance['limit'] ); |
|
131 | - $instance['include'] = strip_tags( $new_instance['include'] ); |
|
132 | - $instance['display'] = strip_tags( $new_instance['display'] ); |
|
133 | - $instance['size'] = strip_tags( $new_instance['size'] ); |
|
134 | - $instance['button_text'] = strip_tags( $new_instance['button_text'] ); |
|
135 | - $instance['responsive'] = strip_tags( $new_instance['responsive'] ); |
|
136 | - $instance['show_image'] = strip_tags( $new_instance['show_image'] ); |
|
137 | - $instance['carousel'] = strip_tags( $new_instance['carousel'] ); |
|
138 | - $instance['featured'] = strip_tags( $new_instance['featured'] ); |
|
124 | + $instance['title'] = wp_kses_post(force_balance_tags($new_instance['title'])); |
|
125 | + $instance['title_link'] = strip_tags($new_instance['title_link']); |
|
126 | + $instance['tagline'] = wp_kses_post(force_balance_tags($new_instance['tagline'])); |
|
127 | + $instance['columns'] = strip_tags($new_instance['columns']); |
|
128 | + $instance['orderby'] = strip_tags($new_instance['orderby']); |
|
129 | + $instance['order'] = strip_tags($new_instance['order']); |
|
130 | + $instance['limit'] = strip_tags($new_instance['limit']); |
|
131 | + $instance['include'] = strip_tags($new_instance['include']); |
|
132 | + $instance['display'] = strip_tags($new_instance['display']); |
|
133 | + $instance['size'] = strip_tags($new_instance['size']); |
|
134 | + $instance['button_text'] = strip_tags($new_instance['button_text']); |
|
135 | + $instance['responsive'] = strip_tags($new_instance['responsive']); |
|
136 | + $instance['show_image'] = strip_tags($new_instance['show_image']); |
|
137 | + $instance['carousel'] = strip_tags($new_instance['carousel']); |
|
138 | + $instance['featured'] = strip_tags($new_instance['featured']); |
|
139 | 139 | |
140 | 140 | return $instance; |
141 | 141 | } |
142 | 142 | |
143 | - function form( $instance ) { |
|
143 | + function form($instance) { |
|
144 | 144 | $defaults = array( |
145 | 145 | 'title' => 'Projects', |
146 | 146 | 'title_link' => '', |
@@ -159,134 +159,134 @@ discard block |
||
159 | 159 | 'featured' => 0, |
160 | 160 | ); |
161 | 161 | |
162 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
162 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
163 | 163 | |
164 | - $title = esc_attr( $instance['title'] ); |
|
165 | - $title_link = esc_attr( $instance['title_link'] ); |
|
166 | - $tagline = esc_attr( $instance['tagline'] ); |
|
167 | - $columns = esc_attr( $instance['columns'] ); |
|
168 | - $orderby = esc_attr( $instance['orderby'] ); |
|
169 | - $order = esc_attr( $instance['order'] ); |
|
170 | - $limit = esc_attr( $instance['limit'] ); |
|
171 | - $include = esc_attr( $instance['include'] ); |
|
172 | - $display = esc_attr( $instance['display'] ); |
|
173 | - $size = esc_attr( $instance['size'] ); |
|
174 | - $button_text = esc_attr( $instance['button_text'] ); |
|
175 | - $responsive = esc_attr( $instance['responsive'] ); |
|
176 | - $show_image = esc_attr( $instance['show_image'] ); |
|
177 | - $carousel = esc_attr( $instance['carousel'] ); |
|
178 | - $featured = esc_attr( $instance['featured'] ); |
|
164 | + $title = esc_attr($instance['title']); |
|
165 | + $title_link = esc_attr($instance['title_link']); |
|
166 | + $tagline = esc_attr($instance['tagline']); |
|
167 | + $columns = esc_attr($instance['columns']); |
|
168 | + $orderby = esc_attr($instance['orderby']); |
|
169 | + $order = esc_attr($instance['order']); |
|
170 | + $limit = esc_attr($instance['limit']); |
|
171 | + $include = esc_attr($instance['include']); |
|
172 | + $display = esc_attr($instance['display']); |
|
173 | + $size = esc_attr($instance['size']); |
|
174 | + $button_text = esc_attr($instance['button_text']); |
|
175 | + $responsive = esc_attr($instance['responsive']); |
|
176 | + $show_image = esc_attr($instance['show_image']); |
|
177 | + $carousel = esc_attr($instance['carousel']); |
|
178 | + $featured = esc_attr($instance['featured']); |
|
179 | 179 | ?> |
180 | 180 | <p> |
181 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'lsx-projects' ); ?></label> |
|
182 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> |
|
181 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'lsx-projects'); ?></label> |
|
182 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" /> |
|
183 | 183 | </p> |
184 | 184 | <p> |
185 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>"><?php esc_html_e( 'Page Link:', 'lsx-projects' ); ?></label> |
|
186 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title_link' ) ); ?>" type="text" value="<?php echo esc_attr( $title_link ); ?>" /> |
|
187 | - <small><?php esc_html_e( 'Link the widget to a page', 'lsx-projects' ); ?></small> |
|
185 | + <label for="<?php echo esc_attr($this->get_field_id('title_link')); ?>"><?php esc_html_e('Page Link:', 'lsx-projects'); ?></label> |
|
186 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title_link')); ?>" name="<?php echo esc_attr($this->get_field_name('title_link')); ?>" type="text" value="<?php echo esc_attr($title_link); ?>" /> |
|
187 | + <small><?php esc_html_e('Link the widget to a page', 'lsx-projects'); ?></small> |
|
188 | 188 | </p> |
189 | 189 | <p> |
190 | - <label for="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>"><?php esc_html_e( 'Tagline:', 'lsx-projects' ); ?></label> |
|
191 | - <textarea class="widefat" rows="8" cols="20" id="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'tagline' ) ); ?>"><?php echo esc_html( $tagline ); ?></textarea> |
|
192 | - <small><?php esc_html_e( 'Tagline to display below the widget title', 'lsx-projects' ); ?></small> |
|
190 | + <label for="<?php echo esc_attr($this->get_field_id('tagline')); ?>"><?php esc_html_e('Tagline:', 'lsx-projects'); ?></label> |
|
191 | + <textarea class="widefat" rows="8" cols="20" id="<?php echo esc_attr($this->get_field_id('tagline')); ?>" name="<?php echo esc_attr($this->get_field_name('tagline')); ?>"><?php echo esc_html($tagline); ?></textarea> |
|
192 | + <small><?php esc_html_e('Tagline to display below the widget title', 'lsx-projects'); ?></small> |
|
193 | 193 | </p> |
194 | 194 | <p> |
195 | - <label for="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>"><?php esc_html_e( 'Columns:', 'lsx-projects' ); ?></label> |
|
196 | - <select name="<?php echo esc_attr( $this->get_field_name( 'columns' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>" class="widefat"> |
|
195 | + <label for="<?php echo esc_attr($this->get_field_id('columns')); ?>"><?php esc_html_e('Columns:', 'lsx-projects'); ?></label> |
|
196 | + <select name="<?php echo esc_attr($this->get_field_name('columns')); ?>" id="<?php echo esc_attr($this->get_field_id('columns')); ?>" class="widefat"> |
|
197 | 197 | <?php |
198 | - $options = array( '1', '2', '3', '4' ); |
|
198 | + $options = array('1', '2', '3', '4'); |
|
199 | 199 | |
200 | - foreach ( $options as $option ) { |
|
201 | - echo '<option value="' . esc_attr( lcfirst( $option ) ) . '" id="' . esc_attr( $option ) . '"', lcfirst( $option ) == $columns ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>'; |
|
200 | + foreach ($options as $option) { |
|
201 | + echo '<option value="' . esc_attr(lcfirst($option)) . '" id="' . esc_attr($option) . '"', lcfirst($option) == $columns ? ' selected="selected"' : '', '>', esc_html($option), '</option>'; |
|
202 | 202 | } |
203 | 203 | ?> |
204 | 204 | </select> |
205 | 205 | </p> |
206 | 206 | <p> |
207 | - <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Order By:', 'lsx-projects' ); ?></label> |
|
208 | - <select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat"> |
|
207 | + <label for="<?php echo esc_attr($this->get_field_id('orderby')); ?>"><?php esc_html_e('Order By:', 'lsx-projects'); ?></label> |
|
208 | + <select name="<?php echo esc_attr($this->get_field_name('orderby')); ?>" id="<?php echo esc_attr($this->get_field_id('orderby')); ?>" class="widefat"> |
|
209 | 209 | <?php |
210 | 210 | $options = array( |
211 | - esc_html__( 'None', 'lsx-projects' ) => 'none', |
|
212 | - esc_html__( 'ID', 'lsx-projects' ) => 'ID', |
|
213 | - esc_html__( 'Name', 'lsx-projects' ) => 'name', |
|
214 | - esc_html__( 'Date', 'lsx-projects' ) => 'date', |
|
215 | - esc_html__( 'Modified Date', 'lsx-projects' ) => 'modified', |
|
216 | - esc_html__( 'Random', 'lsx-projects' ) => 'rand', |
|
217 | - esc_html__( 'Menu (WP dashboard order)', 'lsx-projects' ) => 'menu_order', |
|
211 | + esc_html__('None', 'lsx-projects') => 'none', |
|
212 | + esc_html__('ID', 'lsx-projects') => 'ID', |
|
213 | + esc_html__('Name', 'lsx-projects') => 'name', |
|
214 | + esc_html__('Date', 'lsx-projects') => 'date', |
|
215 | + esc_html__('Modified Date', 'lsx-projects') => 'modified', |
|
216 | + esc_html__('Random', 'lsx-projects') => 'rand', |
|
217 | + esc_html__('Menu (WP dashboard order)', 'lsx-projects') => 'menu_order', |
|
218 | 218 | ); |
219 | 219 | |
220 | - foreach ( $options as $name => $value ) { |
|
221 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
220 | + foreach ($options as $name => $value) { |
|
221 | + echo '<option value="' . esc_attr($value) . '" id="' . esc_attr($value) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html($name), '</option>'; |
|
222 | 222 | } |
223 | 223 | ?> |
224 | 224 | </select> |
225 | 225 | </p> |
226 | 226 | <p> |
227 | - <label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_html_e( 'Order:', 'lsx-projects' ); ?></label> |
|
228 | - <select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" class="widefat"> |
|
227 | + <label for="<?php echo esc_attr($this->get_field_id('order')); ?>"><?php esc_html_e('Order:', 'lsx-projects'); ?></label> |
|
228 | + <select name="<?php echo esc_attr($this->get_field_name('order')); ?>" id="<?php echo esc_attr($this->get_field_id('order')); ?>" class="widefat"> |
|
229 | 229 | <?php |
230 | 230 | $options = array( |
231 | - esc_html__( 'Ascending', 'lsx-projects' ) => 'ASC', |
|
232 | - esc_html__( 'Descending', 'lsx-projects' ) => 'DESC', |
|
231 | + esc_html__('Ascending', 'lsx-projects') => 'ASC', |
|
232 | + esc_html__('Descending', 'lsx-projects') => 'DESC', |
|
233 | 233 | ); |
234 | 234 | |
235 | - foreach ( $options as $name => $value ) { |
|
236 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
235 | + foreach ($options as $name => $value) { |
|
236 | + echo '<option value="' . esc_attr($value) . '" id="' . esc_attr($value) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html($name), '</option>'; |
|
237 | 237 | } |
238 | 238 | ?> |
239 | 239 | </select> |
240 | 240 | </p> |
241 | 241 | <p class="limit"> |
242 | - <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php esc_html_e( 'Maximum amount:', 'lsx-projects' ); ?></label> |
|
243 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo esc_attr( $limit ); ?>" /> |
|
244 | - <small><?php esc_html_e( 'Leave empty to display all', 'lsx-projects' ); ?></small> |
|
242 | + <label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php esc_html_e('Maximum amount:', 'lsx-projects'); ?></label> |
|
243 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" name="<?php echo esc_attr($this->get_field_name('limit')); ?>" type="text" value="<?php echo esc_attr($limit); ?>" /> |
|
244 | + <small><?php esc_html_e('Leave empty to display all', 'lsx-projects'); ?></small> |
|
245 | 245 | </p> |
246 | 246 | <p> |
247 | - <label for="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>"><?php esc_html_e( 'Specify Projects by ID:', 'lsx-projects' ); ?></label> |
|
248 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include' ) ); ?>" type="text" value="<?php echo esc_attr( $include ); ?>" /> |
|
249 | - <small><?php esc_html_e( 'Comma separated list, overrides limit and order settings', 'lsx-projects' ); ?></small> |
|
247 | + <label for="<?php echo esc_attr($this->get_field_id('include')); ?>"><?php esc_html_e('Specify Projects by ID:', 'lsx-projects'); ?></label> |
|
248 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('include')); ?>" name="<?php echo esc_attr($this->get_field_name('include')); ?>" type="text" value="<?php echo esc_attr($include); ?>" /> |
|
249 | + <small><?php esc_html_e('Comma separated list, overrides limit and order settings', 'lsx-projects'); ?></small> |
|
250 | 250 | </p> |
251 | 251 | <p> |
252 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>"><?php esc_html_e( 'Display:', 'lsx-projects' ); ?></label> |
|
253 | - <select name="<?php echo esc_attr( $this->get_field_name( 'display' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>" class="widefat"> |
|
252 | + <label for="<?php echo esc_attr($this->get_field_id('display')); ?>"><?php esc_html_e('Display:', 'lsx-projects'); ?></label> |
|
253 | + <select name="<?php echo esc_attr($this->get_field_name('display')); ?>" id="<?php echo esc_attr($this->get_field_id('display')); ?>" class="widefat"> |
|
254 | 254 | <?php |
255 | 255 | $options = array( |
256 | - esc_html__( 'Excerpt', 'lsx-projects' ) => 'excerpt', |
|
257 | - esc_html__( 'Full Content', 'lsx-projects' ) => 'full', |
|
256 | + esc_html__('Excerpt', 'lsx-projects') => 'excerpt', |
|
257 | + esc_html__('Full Content', 'lsx-projects') => 'full', |
|
258 | 258 | ); |
259 | 259 | |
260 | - foreach ( $options as $name => $value ) { |
|
261 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
260 | + foreach ($options as $name => $value) { |
|
261 | + echo '<option value="' . esc_attr($value) . '" id="' . esc_attr($value) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html($name), '</option>'; |
|
262 | 262 | } |
263 | 263 | ?> |
264 | 264 | </select> |
265 | 265 | </p> |
266 | 266 | <p> |
267 | - <label for="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>"><?php esc_html_e( 'Image size:', 'lsx-projects' ); ?></label> |
|
268 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'size' ) ); ?>" type="text" value="<?php echo esc_attr( $size ); ?>" /> |
|
267 | + <label for="<?php echo esc_attr($this->get_field_id('size')); ?>"><?php esc_html_e('Image size:', 'lsx-projects'); ?></label> |
|
268 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('size')); ?>" name="<?php echo esc_attr($this->get_field_name('size')); ?>" type="text" value="<?php echo esc_attr($size); ?>" /> |
|
269 | 269 | </p> |
270 | 270 | <p> |
271 | - <label for="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>"><?php esc_html_e( 'Button "view all" text:', 'lsx-projects' ); ?></label> |
|
272 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button_text' ) ); ?>" type="text" value="<?php echo esc_attr( $button_text ); ?>" /> |
|
273 | - <small><?php esc_html_e( 'Leave empty to not display the button', 'lsx-projects' ); ?></small> |
|
271 | + <label for="<?php echo esc_attr($this->get_field_id('button_text')); ?>"><?php esc_html_e('Button "view all" text:', 'lsx-projects'); ?></label> |
|
272 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('button_text')); ?>" name="<?php echo esc_attr($this->get_field_name('button_text')); ?>" type="text" value="<?php echo esc_attr($button_text); ?>" /> |
|
273 | + <small><?php esc_html_e('Leave empty to not display the button', 'lsx-projects'); ?></small> |
|
274 | 274 | </p> |
275 | 275 | <p> |
276 | - <input id="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_image' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_image ); ?> /> |
|
277 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>"><?php esc_html_e( 'Display Images', 'lsx-projects' ); ?></label> |
|
276 | + <input id="<?php echo esc_attr($this->get_field_id('show_image')); ?>" name="<?php echo esc_attr($this->get_field_name('show_image')); ?>" type="checkbox" value="1" <?php checked('1', $show_image); ?> /> |
|
277 | + <label for="<?php echo esc_attr($this->get_field_id('show_image')); ?>"><?php esc_html_e('Display Images', 'lsx-projects'); ?></label> |
|
278 | 278 | </p> |
279 | 279 | <p> |
280 | - <input id="<?php echo esc_attr( $this->get_field_id( 'responsive' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'responsive' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $responsive ); ?> /> |
|
281 | - <label for="<?php echo esc_attr( $this->get_field_id( 'responsive' ) ); ?>"><?php esc_html_e( 'Responsive Images', 'lsx-projects' ); ?></label> |
|
280 | + <input id="<?php echo esc_attr($this->get_field_id('responsive')); ?>" name="<?php echo esc_attr($this->get_field_name('responsive')); ?>" type="checkbox" value="1" <?php checked('1', $responsive); ?> /> |
|
281 | + <label for="<?php echo esc_attr($this->get_field_id('responsive')); ?>"><?php esc_html_e('Responsive Images', 'lsx-projects'); ?></label> |
|
282 | 282 | </p> |
283 | 283 | <p> |
284 | - <input id="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'carousel' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $carousel ); ?> /> |
|
285 | - <label for="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>"><?php esc_html_e( 'Carousel', 'lsx-projects' ); ?></label> |
|
284 | + <input id="<?php echo esc_attr($this->get_field_id('carousel')); ?>" name="<?php echo esc_attr($this->get_field_name('carousel')); ?>" type="checkbox" value="1" <?php checked('1', $carousel); ?> /> |
|
285 | + <label for="<?php echo esc_attr($this->get_field_id('carousel')); ?>"><?php esc_html_e('Carousel', 'lsx-projects'); ?></label> |
|
286 | 286 | </p> |
287 | 287 | <p> |
288 | - <input id="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'featured' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $featured ); ?> /> |
|
289 | - <label for="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>"><?php esc_html_e( 'Featured posts', 'lsx-projects' ); ?></label> |
|
288 | + <input id="<?php echo esc_attr($this->get_field_id('featured')); ?>" name="<?php echo esc_attr($this->get_field_name('featured')); ?>" type="checkbox" value="1" <?php checked('1', $featured); ?> /> |
|
289 | + <label for="<?php echo esc_attr($this->get_field_id('featured')); ?>"><?php esc_html_e('Featured posts', 'lsx-projects'); ?></label> |
|
290 | 290 | </p> |
291 | 291 | <?php |
292 | 292 | } |
@@ -294,6 +294,6 @@ discard block |
||
294 | 294 | } |
295 | 295 | |
296 | 296 | function lsx_projects_register_widget() { |
297 | - return register_widget( 'LSX_Projects_Widget' ); |
|
297 | + return register_widget('LSX_Projects_Widget'); |
|
298 | 298 | } |
299 | -add_action( 'widgets_init', 'lsx_projects_register_widget' ); |
|
299 | +add_action('widgets_init', 'lsx_projects_register_widget'); |
@@ -10,173 +10,173 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class LSX_Projects_Widget extends WP_Widget { |
12 | 12 | |
13 | - public function __construct() { |
|
14 | - $widget_ops = array( |
|
15 | - 'classname' => 'lsx-projects', |
|
16 | - ); |
|
13 | + public function __construct() { |
|
14 | + $widget_ops = array( |
|
15 | + 'classname' => 'lsx-projects', |
|
16 | + ); |
|
17 | 17 | |
18 | - parent::__construct( 'LSX_Projects_Widget', esc_html__( 'LSX Projects', 'lsx-projects' ), $widget_ops ); |
|
19 | - } |
|
18 | + parent::__construct( 'LSX_Projects_Widget', esc_html__( 'LSX Projects', 'lsx-projects' ), $widget_ops ); |
|
19 | + } |
|
20 | 20 | |
21 | - function widget( $args, $instance ) { |
|
22 | - extract( $args ); |
|
21 | + function widget( $args, $instance ) { |
|
22 | + extract( $args ); |
|
23 | 23 | |
24 | - $title = $instance['title']; |
|
25 | - $title_link = $instance['title_link']; |
|
26 | - $tagline = $instance['tagline']; |
|
27 | - $columns = $instance['columns']; |
|
28 | - $orderby = $instance['orderby']; |
|
29 | - $order = $instance['order']; |
|
30 | - $limit = $instance['limit']; |
|
31 | - $include = $instance['include']; |
|
32 | - $display = $instance['display']; |
|
33 | - $size = $instance['size']; |
|
34 | - $button_text = $instance['button_text']; |
|
35 | - $responsive = $instance['responsive']; |
|
36 | - $show_image = $instance['show_image']; |
|
37 | - $carousel = $instance['carousel']; |
|
38 | - $featured = $instance['featured']; |
|
24 | + $title = $instance['title']; |
|
25 | + $title_link = $instance['title_link']; |
|
26 | + $tagline = $instance['tagline']; |
|
27 | + $columns = $instance['columns']; |
|
28 | + $orderby = $instance['orderby']; |
|
29 | + $order = $instance['order']; |
|
30 | + $limit = $instance['limit']; |
|
31 | + $include = $instance['include']; |
|
32 | + $display = $instance['display']; |
|
33 | + $size = $instance['size']; |
|
34 | + $button_text = $instance['button_text']; |
|
35 | + $responsive = $instance['responsive']; |
|
36 | + $show_image = $instance['show_image']; |
|
37 | + $carousel = $instance['carousel']; |
|
38 | + $featured = $instance['featured']; |
|
39 | 39 | |
40 | - // If limit not set, display 99 posts |
|
41 | - if ( empty( $limit ) ) { |
|
42 | - $limit = '99'; |
|
43 | - } |
|
40 | + // If limit not set, display 99 posts |
|
41 | + if ( empty( $limit ) ) { |
|
42 | + $limit = '99'; |
|
43 | + } |
|
44 | 44 | |
45 | - // If specific posts included, display 99 posts |
|
46 | - if ( ! empty( $include ) ) { |
|
47 | - $limit = '99'; |
|
48 | - } |
|
45 | + // If specific posts included, display 99 posts |
|
46 | + if ( ! empty( $include ) ) { |
|
47 | + $limit = '99'; |
|
48 | + } |
|
49 | 49 | |
50 | - if ( '1' == $responsive ) { |
|
51 | - $responsive = 'true'; |
|
52 | - } else { |
|
53 | - $responsive = 'false'; |
|
54 | - } |
|
50 | + if ( '1' == $responsive ) { |
|
51 | + $responsive = 'true'; |
|
52 | + } else { |
|
53 | + $responsive = 'false'; |
|
54 | + } |
|
55 | 55 | |
56 | - if ( '1' == $show_image ) { |
|
57 | - $show_image = 'true'; |
|
58 | - } else { |
|
59 | - $show_image = 'false'; |
|
60 | - } |
|
56 | + if ( '1' == $show_image ) { |
|
57 | + $show_image = 'true'; |
|
58 | + } else { |
|
59 | + $show_image = 'false'; |
|
60 | + } |
|
61 | 61 | |
62 | - if ( '1' == $carousel ) { |
|
63 | - $carousel = 'true'; |
|
64 | - } else { |
|
65 | - $carousel = 'false'; |
|
66 | - } |
|
62 | + if ( '1' == $carousel ) { |
|
63 | + $carousel = 'true'; |
|
64 | + } else { |
|
65 | + $carousel = 'false'; |
|
66 | + } |
|
67 | 67 | |
68 | - if ( '1' == $featured ) { |
|
69 | - $featured = 'true'; |
|
70 | - } else { |
|
71 | - $featured = 'false'; |
|
72 | - } |
|
68 | + if ( '1' == $featured ) { |
|
69 | + $featured = 'true'; |
|
70 | + } else { |
|
71 | + $featured = 'false'; |
|
72 | + } |
|
73 | 73 | |
74 | - if ( $title_link ) { |
|
75 | - //$link_open = '<a href="' . $title_link . '">'; |
|
76 | - $link_open = ''; |
|
77 | - $link_btn_open = '<a href="' . $title_link . '" class="btn border-btn">'; |
|
78 | - //$link_close = '</a>'; |
|
79 | - $link_close = ''; |
|
80 | - $link_btn_close = '</a>'; |
|
81 | - } else { |
|
82 | - $link_open = ''; |
|
83 | - $link_btn_open = ''; |
|
84 | - $link_close = ''; |
|
85 | - $link_btn_close = ''; |
|
86 | - } |
|
74 | + if ( $title_link ) { |
|
75 | + //$link_open = '<a href="' . $title_link . '">'; |
|
76 | + $link_open = ''; |
|
77 | + $link_btn_open = '<a href="' . $title_link . '" class="btn border-btn">'; |
|
78 | + //$link_close = '</a>'; |
|
79 | + $link_close = ''; |
|
80 | + $link_btn_close = '</a>'; |
|
81 | + } else { |
|
82 | + $link_open = ''; |
|
83 | + $link_btn_open = ''; |
|
84 | + $link_close = ''; |
|
85 | + $link_btn_close = ''; |
|
86 | + } |
|
87 | 87 | |
88 | - echo wp_kses_post( $before_widget ); |
|
88 | + echo wp_kses_post( $before_widget ); |
|
89 | 89 | |
90 | - if ( $title ) { |
|
91 | - echo wp_kses_post( $before_title . $link_open . $title . $link_close . $after_title ); |
|
92 | - } |
|
90 | + if ( $title ) { |
|
91 | + echo wp_kses_post( $before_title . $link_open . $title . $link_close . $after_title ); |
|
92 | + } |
|
93 | 93 | |
94 | - if ( $tagline ) { |
|
95 | - echo '<p class="tagline text-center">' . esc_html( $tagline ) . '</p>'; |
|
96 | - } |
|
94 | + if ( $tagline ) { |
|
95 | + echo '<p class="tagline text-center">' . esc_html( $tagline ) . '</p>'; |
|
96 | + } |
|
97 | 97 | |
98 | - if ( class_exists( 'LSX_Projects' ) ) { |
|
99 | - lsx_projects( array( |
|
100 | - 'columns' => $columns, |
|
101 | - 'orderby' => $orderby, |
|
102 | - 'order' => $order, |
|
103 | - 'limit' => $limit, |
|
104 | - 'include' => $include, |
|
105 | - 'display' => $display, |
|
106 | - 'size' => $size, |
|
107 | - 'responsive' => $responsive, |
|
108 | - 'show_image' => $show_image, |
|
109 | - 'carousel' => $carousel, |
|
110 | - 'featured' => $featured, |
|
111 | - ) ); |
|
112 | - }; |
|
98 | + if ( class_exists( 'LSX_Projects' ) ) { |
|
99 | + lsx_projects( array( |
|
100 | + 'columns' => $columns, |
|
101 | + 'orderby' => $orderby, |
|
102 | + 'order' => $order, |
|
103 | + 'limit' => $limit, |
|
104 | + 'include' => $include, |
|
105 | + 'display' => $display, |
|
106 | + 'size' => $size, |
|
107 | + 'responsive' => $responsive, |
|
108 | + 'show_image' => $show_image, |
|
109 | + 'carousel' => $carousel, |
|
110 | + 'featured' => $featured, |
|
111 | + ) ); |
|
112 | + }; |
|
113 | 113 | |
114 | - if ( $button_text && $title_link ) { |
|
115 | - echo wp_kses_post( '<p class="text-center lsx-projects-archive-link-wrap"><span class="lsx-projects-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>' ); |
|
116 | - } |
|
114 | + if ( $button_text && $title_link ) { |
|
115 | + echo wp_kses_post( '<p class="text-center lsx-projects-archive-link-wrap"><span class="lsx-projects-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>' ); |
|
116 | + } |
|
117 | 117 | |
118 | - echo wp_kses_post( $after_widget ); |
|
119 | - } |
|
118 | + echo wp_kses_post( $after_widget ); |
|
119 | + } |
|
120 | 120 | |
121 | - function update( $new_instance, $old_instance ) { |
|
122 | - $instance = $old_instance; |
|
121 | + function update( $new_instance, $old_instance ) { |
|
122 | + $instance = $old_instance; |
|
123 | 123 | |
124 | - $instance['title'] = wp_kses_post( force_balance_tags( $new_instance['title'] ) ); |
|
125 | - $instance['title_link'] = strip_tags( $new_instance['title_link'] ); |
|
126 | - $instance['tagline'] = wp_kses_post( force_balance_tags( $new_instance['tagline'] ) ); |
|
127 | - $instance['columns'] = strip_tags( $new_instance['columns'] ); |
|
128 | - $instance['orderby'] = strip_tags( $new_instance['orderby'] ); |
|
129 | - $instance['order'] = strip_tags( $new_instance['order'] ); |
|
130 | - $instance['limit'] = strip_tags( $new_instance['limit'] ); |
|
131 | - $instance['include'] = strip_tags( $new_instance['include'] ); |
|
132 | - $instance['display'] = strip_tags( $new_instance['display'] ); |
|
133 | - $instance['size'] = strip_tags( $new_instance['size'] ); |
|
134 | - $instance['button_text'] = strip_tags( $new_instance['button_text'] ); |
|
135 | - $instance['responsive'] = strip_tags( $new_instance['responsive'] ); |
|
136 | - $instance['show_image'] = strip_tags( $new_instance['show_image'] ); |
|
137 | - $instance['carousel'] = strip_tags( $new_instance['carousel'] ); |
|
138 | - $instance['featured'] = strip_tags( $new_instance['featured'] ); |
|
124 | + $instance['title'] = wp_kses_post( force_balance_tags( $new_instance['title'] ) ); |
|
125 | + $instance['title_link'] = strip_tags( $new_instance['title_link'] ); |
|
126 | + $instance['tagline'] = wp_kses_post( force_balance_tags( $new_instance['tagline'] ) ); |
|
127 | + $instance['columns'] = strip_tags( $new_instance['columns'] ); |
|
128 | + $instance['orderby'] = strip_tags( $new_instance['orderby'] ); |
|
129 | + $instance['order'] = strip_tags( $new_instance['order'] ); |
|
130 | + $instance['limit'] = strip_tags( $new_instance['limit'] ); |
|
131 | + $instance['include'] = strip_tags( $new_instance['include'] ); |
|
132 | + $instance['display'] = strip_tags( $new_instance['display'] ); |
|
133 | + $instance['size'] = strip_tags( $new_instance['size'] ); |
|
134 | + $instance['button_text'] = strip_tags( $new_instance['button_text'] ); |
|
135 | + $instance['responsive'] = strip_tags( $new_instance['responsive'] ); |
|
136 | + $instance['show_image'] = strip_tags( $new_instance['show_image'] ); |
|
137 | + $instance['carousel'] = strip_tags( $new_instance['carousel'] ); |
|
138 | + $instance['featured'] = strip_tags( $new_instance['featured'] ); |
|
139 | 139 | |
140 | - return $instance; |
|
141 | - } |
|
140 | + return $instance; |
|
141 | + } |
|
142 | 142 | |
143 | - function form( $instance ) { |
|
144 | - $defaults = array( |
|
145 | - 'title' => 'Projects', |
|
146 | - 'title_link' => '', |
|
147 | - 'tagline' => '', |
|
148 | - 'columns' => '3', |
|
149 | - 'orderby' => 'name', |
|
150 | - 'order' => 'ASC', |
|
151 | - 'limit' => '', |
|
152 | - 'include' => '', |
|
153 | - 'display' => 'excerpt', |
|
154 | - 'size' => 'lsx-thumbnail-single', |
|
155 | - 'button_text' => '', |
|
156 | - 'responsive' => 1, |
|
157 | - 'show_image' => 1, |
|
158 | - 'carousel' => 1, |
|
159 | - 'featured' => 0, |
|
160 | - ); |
|
143 | + function form( $instance ) { |
|
144 | + $defaults = array( |
|
145 | + 'title' => 'Projects', |
|
146 | + 'title_link' => '', |
|
147 | + 'tagline' => '', |
|
148 | + 'columns' => '3', |
|
149 | + 'orderby' => 'name', |
|
150 | + 'order' => 'ASC', |
|
151 | + 'limit' => '', |
|
152 | + 'include' => '', |
|
153 | + 'display' => 'excerpt', |
|
154 | + 'size' => 'lsx-thumbnail-single', |
|
155 | + 'button_text' => '', |
|
156 | + 'responsive' => 1, |
|
157 | + 'show_image' => 1, |
|
158 | + 'carousel' => 1, |
|
159 | + 'featured' => 0, |
|
160 | + ); |
|
161 | 161 | |
162 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
162 | + $instance = wp_parse_args( (array) $instance, $defaults ); |
|
163 | 163 | |
164 | - $title = esc_attr( $instance['title'] ); |
|
165 | - $title_link = esc_attr( $instance['title_link'] ); |
|
166 | - $tagline = esc_attr( $instance['tagline'] ); |
|
167 | - $columns = esc_attr( $instance['columns'] ); |
|
168 | - $orderby = esc_attr( $instance['orderby'] ); |
|
169 | - $order = esc_attr( $instance['order'] ); |
|
170 | - $limit = esc_attr( $instance['limit'] ); |
|
171 | - $include = esc_attr( $instance['include'] ); |
|
172 | - $display = esc_attr( $instance['display'] ); |
|
173 | - $size = esc_attr( $instance['size'] ); |
|
174 | - $button_text = esc_attr( $instance['button_text'] ); |
|
175 | - $responsive = esc_attr( $instance['responsive'] ); |
|
176 | - $show_image = esc_attr( $instance['show_image'] ); |
|
177 | - $carousel = esc_attr( $instance['carousel'] ); |
|
178 | - $featured = esc_attr( $instance['featured'] ); |
|
179 | - ?> |
|
164 | + $title = esc_attr( $instance['title'] ); |
|
165 | + $title_link = esc_attr( $instance['title_link'] ); |
|
166 | + $tagline = esc_attr( $instance['tagline'] ); |
|
167 | + $columns = esc_attr( $instance['columns'] ); |
|
168 | + $orderby = esc_attr( $instance['orderby'] ); |
|
169 | + $order = esc_attr( $instance['order'] ); |
|
170 | + $limit = esc_attr( $instance['limit'] ); |
|
171 | + $include = esc_attr( $instance['include'] ); |
|
172 | + $display = esc_attr( $instance['display'] ); |
|
173 | + $size = esc_attr( $instance['size'] ); |
|
174 | + $button_text = esc_attr( $instance['button_text'] ); |
|
175 | + $responsive = esc_attr( $instance['responsive'] ); |
|
176 | + $show_image = esc_attr( $instance['show_image'] ); |
|
177 | + $carousel = esc_attr( $instance['carousel'] ); |
|
178 | + $featured = esc_attr( $instance['featured'] ); |
|
179 | + ?> |
|
180 | 180 | <p> |
181 | 181 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'lsx-projects' ); ?></label> |
182 | 182 | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> |
@@ -195,47 +195,47 @@ discard block |
||
195 | 195 | <label for="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>"><?php esc_html_e( 'Columns:', 'lsx-projects' ); ?></label> |
196 | 196 | <select name="<?php echo esc_attr( $this->get_field_name( 'columns' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>" class="widefat"> |
197 | 197 | <?php |
198 | - $options = array( '1', '2', '3', '4' ); |
|
198 | + $options = array( '1', '2', '3', '4' ); |
|
199 | 199 | |
200 | - foreach ( $options as $option ) { |
|
201 | - echo '<option value="' . esc_attr( lcfirst( $option ) ) . '" id="' . esc_attr( $option ) . '"', lcfirst( $option ) == $columns ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>'; |
|
202 | - } |
|
203 | - ?> |
|
200 | + foreach ( $options as $option ) { |
|
201 | + echo '<option value="' . esc_attr( lcfirst( $option ) ) . '" id="' . esc_attr( $option ) . '"', lcfirst( $option ) == $columns ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>'; |
|
202 | + } |
|
203 | + ?> |
|
204 | 204 | </select> |
205 | 205 | </p> |
206 | 206 | <p> |
207 | 207 | <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Order By:', 'lsx-projects' ); ?></label> |
208 | 208 | <select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat"> |
209 | 209 | <?php |
210 | - $options = array( |
|
211 | - esc_html__( 'None', 'lsx-projects' ) => 'none', |
|
212 | - esc_html__( 'ID', 'lsx-projects' ) => 'ID', |
|
213 | - esc_html__( 'Name', 'lsx-projects' ) => 'name', |
|
214 | - esc_html__( 'Date', 'lsx-projects' ) => 'date', |
|
215 | - esc_html__( 'Modified Date', 'lsx-projects' ) => 'modified', |
|
216 | - esc_html__( 'Random', 'lsx-projects' ) => 'rand', |
|
217 | - esc_html__( 'Menu (WP dashboard order)', 'lsx-projects' ) => 'menu_order', |
|
218 | - ); |
|
210 | + $options = array( |
|
211 | + esc_html__( 'None', 'lsx-projects' ) => 'none', |
|
212 | + esc_html__( 'ID', 'lsx-projects' ) => 'ID', |
|
213 | + esc_html__( 'Name', 'lsx-projects' ) => 'name', |
|
214 | + esc_html__( 'Date', 'lsx-projects' ) => 'date', |
|
215 | + esc_html__( 'Modified Date', 'lsx-projects' ) => 'modified', |
|
216 | + esc_html__( 'Random', 'lsx-projects' ) => 'rand', |
|
217 | + esc_html__( 'Menu (WP dashboard order)', 'lsx-projects' ) => 'menu_order', |
|
218 | + ); |
|
219 | 219 | |
220 | - foreach ( $options as $name => $value ) { |
|
221 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
222 | - } |
|
223 | - ?> |
|
220 | + foreach ( $options as $name => $value ) { |
|
221 | + echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
222 | + } |
|
223 | + ?> |
|
224 | 224 | </select> |
225 | 225 | </p> |
226 | 226 | <p> |
227 | 227 | <label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_html_e( 'Order:', 'lsx-projects' ); ?></label> |
228 | 228 | <select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" class="widefat"> |
229 | 229 | <?php |
230 | - $options = array( |
|
231 | - esc_html__( 'Ascending', 'lsx-projects' ) => 'ASC', |
|
232 | - esc_html__( 'Descending', 'lsx-projects' ) => 'DESC', |
|
233 | - ); |
|
230 | + $options = array( |
|
231 | + esc_html__( 'Ascending', 'lsx-projects' ) => 'ASC', |
|
232 | + esc_html__( 'Descending', 'lsx-projects' ) => 'DESC', |
|
233 | + ); |
|
234 | 234 | |
235 | - foreach ( $options as $name => $value ) { |
|
236 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
237 | - } |
|
238 | - ?> |
|
235 | + foreach ( $options as $name => $value ) { |
|
236 | + echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
237 | + } |
|
238 | + ?> |
|
239 | 239 | </select> |
240 | 240 | </p> |
241 | 241 | <p class="limit"> |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | <label for="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>"><?php esc_html_e( 'Display:', 'lsx-projects' ); ?></label> |
253 | 253 | <select name="<?php echo esc_attr( $this->get_field_name( 'display' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>" class="widefat"> |
254 | 254 | <?php |
255 | - $options = array( |
|
256 | - esc_html__( 'Excerpt', 'lsx-projects' ) => 'excerpt', |
|
257 | - esc_html__( 'Full Content', 'lsx-projects' ) => 'full', |
|
258 | - ); |
|
255 | + $options = array( |
|
256 | + esc_html__( 'Excerpt', 'lsx-projects' ) => 'excerpt', |
|
257 | + esc_html__( 'Full Content', 'lsx-projects' ) => 'full', |
|
258 | + ); |
|
259 | 259 | |
260 | - foreach ( $options as $name => $value ) { |
|
261 | - echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
262 | - } |
|
263 | - ?> |
|
260 | + foreach ( $options as $name => $value ) { |
|
261 | + echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>'; |
|
262 | + } |
|
263 | + ?> |
|
264 | 264 | </select> |
265 | 265 | </p> |
266 | 266 | <p> |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | <label for="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>"><?php esc_html_e( 'Featured posts', 'lsx-projects' ); ?></label> |
290 | 290 | </p> |
291 | 291 | <?php |
292 | - } |
|
292 | + } |
|
293 | 293 | |
294 | 294 | } |
295 | 295 | |
296 | 296 | function lsx_projects_register_widget() { |
297 | - return register_widget( 'LSX_Projects_Widget' ); |
|
297 | + return register_widget( 'LSX_Projects_Widget' ); |
|
298 | 298 | } |
299 | 299 | add_action( 'widgets_init', 'lsx_projects_register_widget' ); |
@@ -13,14 +13,14 @@ |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // If this file is called directly, abort. |
16 | -if ( ! defined( 'WPINC' ) ) { |
|
16 | +if ( ! defined('WPINC')) { |
|
17 | 17 | die; |
18 | 18 | } |
19 | 19 | |
20 | -define( 'LSX_PROJECTS_PATH', plugin_dir_path( __FILE__ ) ); |
|
21 | -define( 'LSX_PROJECTS_CORE', __FILE__ ); |
|
22 | -define( 'LSX_PROJECTS_URL', plugin_dir_url( __FILE__ ) ); |
|
23 | -define( 'LSX_PROJECTS_VER', '1.1.3' ); |
|
20 | +define('LSX_PROJECTS_PATH', plugin_dir_path(__FILE__)); |
|
21 | +define('LSX_PROJECTS_CORE', __FILE__); |
|
22 | +define('LSX_PROJECTS_URL', plugin_dir_url(__FILE__)); |
|
23 | +define('LSX_PROJECTS_VER', '1.1.3'); |
|
24 | 24 | |
25 | 25 | /* ======================= Below is the Plugin Class init ========================= */ |
26 | 26 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | // If this file is called directly, abort. |
16 | 16 | if ( ! defined( 'WPINC' ) ) { |
17 | - die; |
|
17 | + die; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | define( 'LSX_PROJECTS_PATH', plugin_dir_path( __FILE__ ) ); |
@@ -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 | |
@@ -221,15 +221,15 @@ discard block |
||
221 | 221 | public function add_form_modal() { |
222 | 222 | global $lsx_projects; |
223 | 223 | |
224 | - if ( empty( $lsx_projects->options['display']['projects_modal_enable'] ) ) { |
|
224 | + if (empty($lsx_projects->options['display']['projects_modal_enable'])) { |
|
225 | 225 | return ''; |
226 | 226 | } |
227 | 227 | |
228 | - if ( empty( $lsx_projects->options['display']['projects_modal_cta_label'] ) || empty( $lsx_projects->options['display']['projects_modal_form_id'] ) ) { |
|
228 | + if (empty($lsx_projects->options['display']['projects_modal_cta_label']) || empty($lsx_projects->options['display']['projects_modal_form_id'])) { |
|
229 | 229 | return ''; |
230 | 230 | } |
231 | 231 | |
232 | - if ( ! is_single( 'project' ) ) { |
|
232 | + if ( ! is_single('project')) { |
|
233 | 233 | return ''; |
234 | 234 | } |
235 | 235 | ?> |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | <button type="button" class="close" data-dismiss="modal">×</button> |
240 | 240 | |
241 | 241 | <div class="modal-header"> |
242 | - <h4 class="modal-title"><?php echo esc_html( $lsx_projects->options['display']['projects_modal_cta_label'] ); ?></h4> |
|
242 | + <h4 class="modal-title"><?php echo esc_html($lsx_projects->options['display']['projects_modal_cta_label']); ?></h4> |
|
243 | 243 | </div> |
244 | 244 | |
245 | 245 | <div class="modal-body"> |
246 | - <?php echo do_shortcode( '[caldera_form id="' . $lsx_projects->options['display']['projects_modal_form_id'] . '"]' ); ?> |
|
246 | + <?php echo do_shortcode('[caldera_form id="' . $lsx_projects->options['display']['projects_modal_form_id'] . '"]'); ?> |
|
247 | 247 | </div> |
248 | 248 | </div> |
249 | 249 | </div> |
@@ -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,105 +134,105 @@ 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 | - global $lsx_projects; |
|
223 | - |
|
224 | - if ( empty( $lsx_projects->options['display']['projects_modal_enable'] ) ) { |
|
225 | - return ''; |
|
226 | - } |
|
227 | - |
|
228 | - if ( empty( $lsx_projects->options['display']['projects_modal_cta_label'] ) || empty( $lsx_projects->options['display']['projects_modal_form_id'] ) ) { |
|
229 | - return ''; |
|
230 | - } |
|
231 | - |
|
232 | - if ( ! is_single( 'project' ) ) { |
|
233 | - return ''; |
|
234 | - } |
|
235 | - ?> |
|
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 | + global $lsx_projects; |
|
223 | + |
|
224 | + if ( empty( $lsx_projects->options['display']['projects_modal_enable'] ) ) { |
|
225 | + return ''; |
|
226 | + } |
|
227 | + |
|
228 | + if ( empty( $lsx_projects->options['display']['projects_modal_cta_label'] ) || empty( $lsx_projects->options['display']['projects_modal_form_id'] ) ) { |
|
229 | + return ''; |
|
230 | + } |
|
231 | + |
|
232 | + if ( ! is_single( 'project' ) ) { |
|
233 | + return ''; |
|
234 | + } |
|
235 | + ?> |
|
236 | 236 | <div class="lsx-modal modal fade" id="lsx-project-contact" role="dialog"> |
237 | 237 | <div class="modal-dialog"> |
238 | 238 | <div class="modal-content"> |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | </div> |
250 | 250 | </div> |
251 | 251 | <?php |
252 | - } |
|
252 | + } |
|
253 | 253 | |
254 | 254 | } |
255 | 255 |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | public function __construct() { |
16 | 16 | $this->options = projects_get_options(); |
17 | 17 | |
18 | - add_filter( 'lsx_banner_allowed_post_types', array( $this, 'lsx_banner_allowed_post_types' ) ); |
|
19 | - add_filter( 'lsx_banner_allowed_taxonomies', array( $this, 'lsx_banner_allowed_taxonomies' ) ); |
|
18 | + add_filter('lsx_banner_allowed_post_types', array($this, 'lsx_banner_allowed_post_types')); |
|
19 | + add_filter('lsx_banner_allowed_taxonomies', array($this, 'lsx_banner_allowed_taxonomies')); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Enable project custom post type on LSX Banners. |
24 | 24 | */ |
25 | - public function lsx_banner_allowed_post_types( $post_types ) { |
|
25 | + public function lsx_banner_allowed_post_types($post_types) { |
|
26 | 26 | $post_types[] = 'project'; |
27 | 27 | return $post_types; |
28 | 28 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * Enable project custom taxonomies on LSX Banners. |
32 | 32 | */ |
33 | - public function lsx_banner_allowed_taxonomies( $taxonomies ) { |
|
33 | + public function lsx_banner_allowed_taxonomies($taxonomies) { |
|
34 | 34 | $taxonomies[] = 'project-group'; |
35 | 35 | return $taxonomies; |
36 | 36 | } |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Returns the shortcode output markup |
40 | 40 | */ |
41 | - public function output( $atts ) { |
|
41 | + public function output($atts) { |
|
42 | 42 | // @codingStandardsIgnoreLine |
43 | - extract( shortcode_atts( array( |
|
43 | + extract(shortcode_atts(array( |
|
44 | 44 | 'columns' => 3, |
45 | 45 | 'orderby' => 'name', |
46 | 46 | 'order' => 'ASC', |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | 'show_image' => 'true', |
53 | 53 | 'carousel' => 'true', |
54 | 54 | 'featured' => 'false', |
55 | - ), $atts ) ); |
|
55 | + ), $atts)); |
|
56 | 56 | |
57 | 57 | $output = ''; |
58 | 58 | |
59 | - if ( 'true' === $responsive || true === $responsive ) { |
|
59 | + if ('true' === $responsive || true === $responsive) { |
|
60 | 60 | $responsive = ' img-responsive'; |
61 | 61 | } else { |
62 | 62 | $responsive = ''; |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $this->columns = $columns; |
66 | 66 | $this->responsive = $responsive; |
67 | 67 | |
68 | - if ( ! empty( $include ) ) { |
|
69 | - $include = explode( ',', $include ); |
|
68 | + if ( ! empty($include)) { |
|
69 | + $include = explode(',', $include); |
|
70 | 70 | |
71 | 71 | $args = array( |
72 | 72 | 'post_type' => 'project', |
@@ -83,27 +83,27 @@ discard block |
||
83 | 83 | 'order' => $order, |
84 | 84 | ); |
85 | 85 | |
86 | - if ( 'true' === $featured || true === $featured ) { |
|
86 | + if ('true' === $featured || true === $featured) { |
|
87 | 87 | $args['meta_key'] = 'lsx_project_featured'; |
88 | 88 | $args['meta_value'] = 1; |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - $projects = new \WP_Query( $args ); |
|
92 | + $projects = new \WP_Query($args); |
|
93 | 93 | |
94 | - if ( $projects->have_posts() ) { |
|
94 | + if ($projects->have_posts()) { |
|
95 | 95 | global $post; |
96 | 96 | |
97 | 97 | $count = 0; |
98 | 98 | $count_global = 0; |
99 | 99 | |
100 | - if ( 'true' === $carousel || true === $carousel ) { |
|
100 | + if ('true' === $carousel || true === $carousel) { |
|
101 | 101 | $output .= "<div id='lsx-projects-slider' class='lsx-projects-shortcode' data-slick='{\"slidesToShow\": $columns, \"slidesToScroll\": $columns }'>"; |
102 | 102 | } else { |
103 | 103 | $output .= "<div class='lsx-projects-shortcode'><div class='row'>"; |
104 | 104 | } |
105 | 105 | |
106 | - while ( $projects->have_posts() ) { |
|
106 | + while ($projects->have_posts()) { |
|
107 | 107 | $projects->the_post(); |
108 | 108 | |
109 | 109 | // Count |
@@ -111,31 +111,31 @@ discard block |
||
111 | 111 | $count_global++; |
112 | 112 | |
113 | 113 | // Content |
114 | - if ( 'full' === $display ) { |
|
115 | - $content = apply_filters( 'the_content', get_the_content() ); |
|
116 | - $content = str_replace( ']]>', ']]>', $content ); |
|
117 | - } elseif ( 'excerpt' === $display ) { |
|
118 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
114 | + if ('full' === $display) { |
|
115 | + $content = apply_filters('the_content', get_the_content()); |
|
116 | + $content = str_replace(']]>', ']]>', $content); |
|
117 | + } elseif ('excerpt' === $display) { |
|
118 | + $content = apply_filters('the_excerpt', get_the_excerpt()); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // Image |
122 | - if ( 'true' === $show_image || true === $show_image ) { |
|
123 | - if ( is_numeric( $size ) ) { |
|
124 | - $thumb_size = array( $size, $size ); |
|
122 | + if ('true' === $show_image || true === $show_image) { |
|
123 | + if (is_numeric($size)) { |
|
124 | + $thumb_size = array($size, $size); |
|
125 | 125 | } else { |
126 | 126 | $thumb_size = $size; |
127 | 127 | } |
128 | 128 | |
129 | - if ( ! empty( get_the_post_thumbnail( $post->ID ) ) ) { |
|
130 | - $image = get_the_post_thumbnail( $post->ID, $thumb_size, array( |
|
129 | + if ( ! empty(get_the_post_thumbnail($post->ID))) { |
|
130 | + $image = get_the_post_thumbnail($post->ID, $thumb_size, array( |
|
131 | 131 | 'class' => $responsive, |
132 | - ) ); |
|
132 | + )); |
|
133 | 133 | } else { |
134 | 134 | $image = ''; |
135 | 135 | } |
136 | 136 | |
137 | - if ( empty( $image ) ) { |
|
138 | - if ( ! empty( $this->options['display']['projects_placeholder'] ) ) { |
|
137 | + if (empty($image)) { |
|
138 | + if ( ! empty($this->options['display']['projects_placeholder'])) { |
|
139 | 139 | $image = '<img class="' . $responsive . '" src="' . $this->options['display']['projects_placeholder'] . '" width="' . $size . '" alt="placeholder" />'; |
140 | 140 | } else { |
141 | 141 | $image = ''; |
@@ -147,42 +147,42 @@ discard block |
||
147 | 147 | |
148 | 148 | // Project groups |
149 | 149 | $groups = ''; |
150 | - $terms = get_the_terms( $post->ID, 'project-group' ); |
|
150 | + $terms = get_the_terms($post->ID, 'project-group'); |
|
151 | 151 | |
152 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
152 | + if ($terms && ! is_wp_error($terms)) { |
|
153 | 153 | $groups = array(); |
154 | 154 | |
155 | - foreach ( $terms as $term ) { |
|
155 | + foreach ($terms as $term) { |
|
156 | 156 | $groups[] = $term->name; |
157 | 157 | } |
158 | 158 | |
159 | - $groups = join( ', ', $groups ); |
|
159 | + $groups = join(', ', $groups); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | $project_groups = '' !== $groups ? "<p class='lsx-projects-groups'>$groups</p>" : ''; |
163 | 163 | |
164 | - if ( 'true' === $carousel || true === $carousel ) { |
|
164 | + if ('true' === $carousel || true === $carousel) { |
|
165 | 165 | $output .= " |
166 | 166 | <div class='lsx-projects-slot'> |
167 | - " . ( ! empty( $image ) ? "<a href='" . get_permalink() . "'><figure class='lsx-projects-avatar'>$image</figure></a>" : '' ) . " |
|
168 | - <h5 class='lsx-projects-title'><a href='" . get_permalink() . "'>" . apply_filters( 'the_title', $post->post_title ) . "</a></h5> |
|
167 | + " . ( ! empty($image) ? "<a href='" . get_permalink() . "'><figure class='lsx-projects-avatar'>$image</figure></a>" : '') . " |
|
168 | + <h5 class='lsx-projects-title'><a href='" . get_permalink() . "'>" . apply_filters('the_title', $post->post_title) . "</a></h5> |
|
169 | 169 | $project_groups |
170 | - <div class='lsx-projects-content'><a href='" . get_permalink() . "' class='moretag'>" . esc_html__( 'View more', 'lsx-projects' ) . '</a></div> |
|
170 | + <div class='lsx-projects-content'><a href='" . get_permalink() . "' class='moretag'>" . esc_html__('View more', 'lsx-projects') . '</a></div> |
|
171 | 171 | </div>'; |
172 | - } elseif ( $columns >= 1 && $columns <= 4 ) { |
|
172 | + } elseif ($columns >= 1 && $columns <= 4) { |
|
173 | 173 | $md_col_width = 12 / $columns; |
174 | 174 | |
175 | 175 | $output .= " |
176 | 176 | <div class='col-xs-12 col-md-" . $md_col_width . "'> |
177 | 177 | <div class='lsx-projects-slot'> |
178 | - " . ( ! empty( $image ) ? "<a href='" . get_permalink() . "'><figure class='lsx-projects-avatar'>$image</figure></a>" : '' ) . " |
|
179 | - <h5 class='lsx-projects-title'><a href='" . get_permalink() . "'>" . apply_filters( 'the_title', $post->post_title ) . "</a></h5> |
|
178 | + " . ( ! empty($image) ? "<a href='" . get_permalink() . "'><figure class='lsx-projects-avatar'>$image</figure></a>" : '') . " |
|
179 | + <h5 class='lsx-projects-title'><a href='" . get_permalink() . "'>" . apply_filters('the_title', $post->post_title) . "</a></h5> |
|
180 | 180 | $project_groups |
181 | - <div class='lsx-projects-content'><a href='" . get_permalink() . "' class='moretag'>" . esc_html__( 'View more', 'lsx-projects' ) . '</a></div> |
|
181 | + <div class='lsx-projects-content'><a href='" . get_permalink() . "' class='moretag'>" . esc_html__('View more', 'lsx-projects') . '</a></div> |
|
182 | 182 | </div> |
183 | 183 | </div>'; |
184 | 184 | |
185 | - if ( $count == $columns && $projects->post_count > $count_global ) { |
|
185 | + if ($count == $columns && $projects->post_count > $count_global) { |
|
186 | 186 | $output .= '</div>'; |
187 | 187 | $output .= "<div class='row'>"; |
188 | 188 | $count = 0; |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | } else { |
191 | 191 | $output .= " |
192 | 192 | <p class='bg-warning' style='padding: 20px;'> |
193 | - " . esc_html__( 'Invalid number of columns set. LSX Projects supports 1 to 4 columns.', 'lsx-projects' ) . ' |
|
193 | + " . esc_html__('Invalid number of columns set. LSX Projects supports 1 to 4 columns.', 'lsx-projects') . ' |
|
194 | 194 | </p>'; |
195 | 195 | } |
196 | 196 | |
197 | 197 | wp_reset_postdata(); |
198 | 198 | } |
199 | 199 | |
200 | - if ( 'true' !== $carousel && true !== $carousel ) { |
|
200 | + if ('true' !== $carousel && true !== $carousel) { |
|
201 | 201 | $output .= '</div>'; |
202 | 202 | } |
203 | 203 |
@@ -10,169 +10,169 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class LSX_Projects { |
12 | 12 | |
13 | - public $columns, $responsive, $options; |
|
14 | - |
|
15 | - public function __construct() { |
|
16 | - $this->options = projects_get_options(); |
|
17 | - |
|
18 | - add_filter( 'lsx_banner_allowed_post_types', array( $this, 'lsx_banner_allowed_post_types' ) ); |
|
19 | - add_filter( 'lsx_banner_allowed_taxonomies', array( $this, 'lsx_banner_allowed_taxonomies' ) ); |
|
20 | - } |
|
21 | - |
|
22 | - /** |
|
23 | - * Enable project custom post type on LSX Banners. |
|
24 | - */ |
|
25 | - public function lsx_banner_allowed_post_types( $post_types ) { |
|
26 | - $post_types[] = 'project'; |
|
27 | - return $post_types; |
|
28 | - } |
|
29 | - |
|
30 | - /** |
|
31 | - * Enable project custom taxonomies on LSX Banners. |
|
32 | - */ |
|
33 | - public function lsx_banner_allowed_taxonomies( $taxonomies ) { |
|
34 | - $taxonomies[] = 'project-group'; |
|
35 | - return $taxonomies; |
|
36 | - } |
|
37 | - |
|
38 | - /** |
|
39 | - * Returns the shortcode output markup |
|
40 | - */ |
|
41 | - public function output( $atts ) { |
|
42 | - // @codingStandardsIgnoreLine |
|
43 | - extract( shortcode_atts( array( |
|
44 | - 'columns' => 3, |
|
45 | - 'orderby' => 'name', |
|
46 | - 'order' => 'ASC', |
|
47 | - 'limit' => '-1', |
|
48 | - 'include' => '', |
|
49 | - 'display' => 'excerpt', |
|
50 | - 'size' => 'lsx-thumbnail-single', |
|
51 | - 'responsive' => 'true', |
|
52 | - 'show_image' => 'true', |
|
53 | - 'carousel' => 'true', |
|
54 | - 'featured' => 'false', |
|
55 | - ), $atts ) ); |
|
56 | - |
|
57 | - $output = ''; |
|
58 | - |
|
59 | - if ( 'true' === $responsive || true === $responsive ) { |
|
60 | - $responsive = ' img-responsive'; |
|
61 | - } else { |
|
62 | - $responsive = ''; |
|
63 | - } |
|
64 | - |
|
65 | - $this->columns = $columns; |
|
66 | - $this->responsive = $responsive; |
|
67 | - |
|
68 | - if ( ! empty( $include ) ) { |
|
69 | - $include = explode( ',', $include ); |
|
70 | - |
|
71 | - $args = array( |
|
72 | - 'post_type' => 'project', |
|
73 | - 'posts_per_page' => $limit, |
|
74 | - 'post__in' => $include, |
|
75 | - 'orderby' => 'post__in', |
|
76 | - 'order' => $order, |
|
77 | - ); |
|
78 | - } else { |
|
79 | - $args = array( |
|
80 | - 'post_type' => 'project', |
|
81 | - 'posts_per_page' => $limit, |
|
82 | - 'orderby' => $orderby, |
|
83 | - 'order' => $order, |
|
84 | - ); |
|
85 | - |
|
86 | - if ( 'true' === $featured || true === $featured ) { |
|
87 | - $args['meta_key'] = 'lsx_project_featured'; |
|
88 | - $args['meta_value'] = 1; |
|
89 | - } |
|
90 | - } |
|
91 | - |
|
92 | - $projects = new \WP_Query( $args ); |
|
93 | - |
|
94 | - if ( $projects->have_posts() ) { |
|
95 | - global $post; |
|
96 | - |
|
97 | - $count = 0; |
|
98 | - $count_global = 0; |
|
99 | - |
|
100 | - if ( 'true' === $carousel || true === $carousel ) { |
|
101 | - $output .= "<div id='lsx-projects-slider' class='lsx-projects-shortcode' data-slick='{\"slidesToShow\": $columns, \"slidesToScroll\": $columns }'>"; |
|
102 | - } else { |
|
103 | - $output .= "<div class='lsx-projects-shortcode'><div class='row'>"; |
|
104 | - } |
|
105 | - |
|
106 | - while ( $projects->have_posts() ) { |
|
107 | - $projects->the_post(); |
|
108 | - |
|
109 | - // Count |
|
110 | - $count++; |
|
111 | - $count_global++; |
|
112 | - |
|
113 | - // Content |
|
114 | - if ( 'full' === $display ) { |
|
115 | - $content = apply_filters( 'the_content', get_the_content() ); |
|
116 | - $content = str_replace( ']]>', ']]>', $content ); |
|
117 | - } elseif ( 'excerpt' === $display ) { |
|
118 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
119 | - } |
|
120 | - |
|
121 | - // Image |
|
122 | - if ( 'true' === $show_image || true === $show_image ) { |
|
123 | - if ( is_numeric( $size ) ) { |
|
124 | - $thumb_size = array( $size, $size ); |
|
125 | - } else { |
|
126 | - $thumb_size = $size; |
|
127 | - } |
|
128 | - |
|
129 | - if ( ! empty( get_the_post_thumbnail( $post->ID ) ) ) { |
|
130 | - $image = get_the_post_thumbnail( $post->ID, $thumb_size, array( |
|
131 | - 'class' => $responsive, |
|
132 | - ) ); |
|
133 | - } else { |
|
134 | - $image = ''; |
|
135 | - } |
|
136 | - |
|
137 | - if ( empty( $image ) ) { |
|
138 | - if ( ! empty( $this->options['display']['projects_placeholder'] ) ) { |
|
139 | - $image = '<img class="' . $responsive . '" src="' . $this->options['display']['projects_placeholder'] . '" width="' . $size . '" alt="placeholder" />'; |
|
140 | - } else { |
|
141 | - $image = ''; |
|
142 | - } |
|
143 | - } |
|
144 | - } else { |
|
145 | - $image = ''; |
|
146 | - } |
|
147 | - |
|
148 | - // Project groups |
|
149 | - $groups = ''; |
|
150 | - $terms = get_the_terms( $post->ID, 'project-group' ); |
|
151 | - |
|
152 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
153 | - $groups = array(); |
|
154 | - |
|
155 | - foreach ( $terms as $term ) { |
|
156 | - $groups[] = $term->name; |
|
157 | - } |
|
158 | - |
|
159 | - $groups = join( ', ', $groups ); |
|
160 | - } |
|
161 | - |
|
162 | - $project_groups = '' !== $groups ? "<p class='lsx-projects-groups'>$groups</p>" : ''; |
|
163 | - |
|
164 | - if ( 'true' === $carousel || true === $carousel ) { |
|
165 | - $output .= " |
|
13 | + public $columns, $responsive, $options; |
|
14 | + |
|
15 | + public function __construct() { |
|
16 | + $this->options = projects_get_options(); |
|
17 | + |
|
18 | + add_filter( 'lsx_banner_allowed_post_types', array( $this, 'lsx_banner_allowed_post_types' ) ); |
|
19 | + add_filter( 'lsx_banner_allowed_taxonomies', array( $this, 'lsx_banner_allowed_taxonomies' ) ); |
|
20 | + } |
|
21 | + |
|
22 | + /** |
|
23 | + * Enable project custom post type on LSX Banners. |
|
24 | + */ |
|
25 | + public function lsx_banner_allowed_post_types( $post_types ) { |
|
26 | + $post_types[] = 'project'; |
|
27 | + return $post_types; |
|
28 | + } |
|
29 | + |
|
30 | + /** |
|
31 | + * Enable project custom taxonomies on LSX Banners. |
|
32 | + */ |
|
33 | + public function lsx_banner_allowed_taxonomies( $taxonomies ) { |
|
34 | + $taxonomies[] = 'project-group'; |
|
35 | + return $taxonomies; |
|
36 | + } |
|
37 | + |
|
38 | + /** |
|
39 | + * Returns the shortcode output markup |
|
40 | + */ |
|
41 | + public function output( $atts ) { |
|
42 | + // @codingStandardsIgnoreLine |
|
43 | + extract( shortcode_atts( array( |
|
44 | + 'columns' => 3, |
|
45 | + 'orderby' => 'name', |
|
46 | + 'order' => 'ASC', |
|
47 | + 'limit' => '-1', |
|
48 | + 'include' => '', |
|
49 | + 'display' => 'excerpt', |
|
50 | + 'size' => 'lsx-thumbnail-single', |
|
51 | + 'responsive' => 'true', |
|
52 | + 'show_image' => 'true', |
|
53 | + 'carousel' => 'true', |
|
54 | + 'featured' => 'false', |
|
55 | + ), $atts ) ); |
|
56 | + |
|
57 | + $output = ''; |
|
58 | + |
|
59 | + if ( 'true' === $responsive || true === $responsive ) { |
|
60 | + $responsive = ' img-responsive'; |
|
61 | + } else { |
|
62 | + $responsive = ''; |
|
63 | + } |
|
64 | + |
|
65 | + $this->columns = $columns; |
|
66 | + $this->responsive = $responsive; |
|
67 | + |
|
68 | + if ( ! empty( $include ) ) { |
|
69 | + $include = explode( ',', $include ); |
|
70 | + |
|
71 | + $args = array( |
|
72 | + 'post_type' => 'project', |
|
73 | + 'posts_per_page' => $limit, |
|
74 | + 'post__in' => $include, |
|
75 | + 'orderby' => 'post__in', |
|
76 | + 'order' => $order, |
|
77 | + ); |
|
78 | + } else { |
|
79 | + $args = array( |
|
80 | + 'post_type' => 'project', |
|
81 | + 'posts_per_page' => $limit, |
|
82 | + 'orderby' => $orderby, |
|
83 | + 'order' => $order, |
|
84 | + ); |
|
85 | + |
|
86 | + if ( 'true' === $featured || true === $featured ) { |
|
87 | + $args['meta_key'] = 'lsx_project_featured'; |
|
88 | + $args['meta_value'] = 1; |
|
89 | + } |
|
90 | + } |
|
91 | + |
|
92 | + $projects = new \WP_Query( $args ); |
|
93 | + |
|
94 | + if ( $projects->have_posts() ) { |
|
95 | + global $post; |
|
96 | + |
|
97 | + $count = 0; |
|
98 | + $count_global = 0; |
|
99 | + |
|
100 | + if ( 'true' === $carousel || true === $carousel ) { |
|
101 | + $output .= "<div id='lsx-projects-slider' class='lsx-projects-shortcode' data-slick='{\"slidesToShow\": $columns, \"slidesToScroll\": $columns }'>"; |
|
102 | + } else { |
|
103 | + $output .= "<div class='lsx-projects-shortcode'><div class='row'>"; |
|
104 | + } |
|
105 | + |
|
106 | + while ( $projects->have_posts() ) { |
|
107 | + $projects->the_post(); |
|
108 | + |
|
109 | + // Count |
|
110 | + $count++; |
|
111 | + $count_global++; |
|
112 | + |
|
113 | + // Content |
|
114 | + if ( 'full' === $display ) { |
|
115 | + $content = apply_filters( 'the_content', get_the_content() ); |
|
116 | + $content = str_replace( ']]>', ']]>', $content ); |
|
117 | + } elseif ( 'excerpt' === $display ) { |
|
118 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
119 | + } |
|
120 | + |
|
121 | + // Image |
|
122 | + if ( 'true' === $show_image || true === $show_image ) { |
|
123 | + if ( is_numeric( $size ) ) { |
|
124 | + $thumb_size = array( $size, $size ); |
|
125 | + } else { |
|
126 | + $thumb_size = $size; |
|
127 | + } |
|
128 | + |
|
129 | + if ( ! empty( get_the_post_thumbnail( $post->ID ) ) ) { |
|
130 | + $image = get_the_post_thumbnail( $post->ID, $thumb_size, array( |
|
131 | + 'class' => $responsive, |
|
132 | + ) ); |
|
133 | + } else { |
|
134 | + $image = ''; |
|
135 | + } |
|
136 | + |
|
137 | + if ( empty( $image ) ) { |
|
138 | + if ( ! empty( $this->options['display']['projects_placeholder'] ) ) { |
|
139 | + $image = '<img class="' . $responsive . '" src="' . $this->options['display']['projects_placeholder'] . '" width="' . $size . '" alt="placeholder" />'; |
|
140 | + } else { |
|
141 | + $image = ''; |
|
142 | + } |
|
143 | + } |
|
144 | + } else { |
|
145 | + $image = ''; |
|
146 | + } |
|
147 | + |
|
148 | + // Project groups |
|
149 | + $groups = ''; |
|
150 | + $terms = get_the_terms( $post->ID, 'project-group' ); |
|
151 | + |
|
152 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
153 | + $groups = array(); |
|
154 | + |
|
155 | + foreach ( $terms as $term ) { |
|
156 | + $groups[] = $term->name; |
|
157 | + } |
|
158 | + |
|
159 | + $groups = join( ', ', $groups ); |
|
160 | + } |
|
161 | + |
|
162 | + $project_groups = '' !== $groups ? "<p class='lsx-projects-groups'>$groups</p>" : ''; |
|
163 | + |
|
164 | + if ( 'true' === $carousel || true === $carousel ) { |
|
165 | + $output .= " |
|
166 | 166 | <div class='lsx-projects-slot'> |
167 | 167 | " . ( ! empty( $image ) ? "<a href='" . get_permalink() . "'><figure class='lsx-projects-avatar'>$image</figure></a>" : '' ) . " |
168 | 168 | <h5 class='lsx-projects-title'><a href='" . get_permalink() . "'>" . apply_filters( 'the_title', $post->post_title ) . "</a></h5> |
169 | 169 | $project_groups |
170 | 170 | <div class='lsx-projects-content'><a href='" . get_permalink() . "' class='moretag'>" . esc_html__( 'View more', 'lsx-projects' ) . '</a></div> |
171 | 171 | </div>'; |
172 | - } elseif ( $columns >= 1 && $columns <= 4 ) { |
|
173 | - $md_col_width = 12 / $columns; |
|
172 | + } elseif ( $columns >= 1 && $columns <= 4 ) { |
|
173 | + $md_col_width = 12 / $columns; |
|
174 | 174 | |
175 | - $output .= " |
|
175 | + $output .= " |
|
176 | 176 | <div class='col-xs-12 col-md-" . $md_col_width . "'> |
177 | 177 | <div class='lsx-projects-slot'> |
178 | 178 | " . ( ! empty( $image ) ? "<a href='" . get_permalink() . "'><figure class='lsx-projects-avatar'>$image</figure></a>" : '' ) . " |
@@ -182,30 +182,30 @@ discard block |
||
182 | 182 | </div> |
183 | 183 | </div>'; |
184 | 184 | |
185 | - if ( $count == $columns && $projects->post_count > $count_global ) { |
|
186 | - $output .= '</div>'; |
|
187 | - $output .= "<div class='row'>"; |
|
188 | - $count = 0; |
|
189 | - } |
|
190 | - } else { |
|
191 | - $output .= " |
|
185 | + if ( $count == $columns && $projects->post_count > $count_global ) { |
|
186 | + $output .= '</div>'; |
|
187 | + $output .= "<div class='row'>"; |
|
188 | + $count = 0; |
|
189 | + } |
|
190 | + } else { |
|
191 | + $output .= " |
|
192 | 192 | <p class='bg-warning' style='padding: 20px;'> |
193 | 193 | " . esc_html__( 'Invalid number of columns set. LSX Projects supports 1 to 4 columns.', 'lsx-projects' ) . ' |
194 | 194 | </p>'; |
195 | - } |
|
195 | + } |
|
196 | 196 | |
197 | - wp_reset_postdata(); |
|
198 | - } |
|
197 | + wp_reset_postdata(); |
|
198 | + } |
|
199 | 199 | |
200 | - if ( 'true' !== $carousel && true !== $carousel ) { |
|
201 | - $output .= '</div>'; |
|
202 | - } |
|
200 | + if ( 'true' !== $carousel && true !== $carousel ) { |
|
201 | + $output .= '</div>'; |
|
202 | + } |
|
203 | 203 | |
204 | - $output .= '</div>'; |
|
204 | + $output .= '</div>'; |
|
205 | 205 | |
206 | - return $output; |
|
207 | - } |
|
208 | - } |
|
206 | + return $output; |
|
207 | + } |
|
208 | + } |
|
209 | 209 | |
210 | 210 | } |
211 | 211 |
@@ -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,28 +121,28 @@ 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' ), |
|
129 | + 'name' => __('Contact modal', 'lsx-projects'), |
|
130 | 130 | ) |
131 | 131 | ); |
132 | 132 | $cmb->add_field( |
133 | 133 | array( |
134 | - 'name' => __( 'Enable contact modal', 'lsx-projects' ), |
|
134 | + 'name' => __('Enable contact modal', 'lsx-projects'), |
|
135 | 135 | 'id' => 'projects_modal_enable', |
136 | 136 | 'type' => 'checkbox', |
137 | 137 | 'value' => 1, |
138 | 138 | 'default' => 0, |
139 | - 'description' => __( 'Displays contact modal on project single.', 'lsx-projects' ), |
|
139 | + 'description' => __('Displays contact modal on project single.', 'lsx-projects'), |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | |
143 | 143 | $cmb->add_field( |
144 | 144 | array( |
145 | - 'name' => __( 'Button label', 'lsx-projects' ), |
|
145 | + 'name' => __('Button label', 'lsx-projects'), |
|
146 | 146 | 'id' => 'projects_modal_cta_label', |
147 | 147 | 'type' => 'text', |
148 | 148 | ) |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $cmb->add_field( |
152 | 152 | array( |
153 | - 'name' => __( 'Caldera Form ID', 'lsx-projects' ), |
|
153 | + 'name' => __('Caldera Form ID', 'lsx-projects'), |
|
154 | 154 | 'id' => 'projects_modal_form_id', |
155 | 155 | 'type' => 'text', |
156 | 156 | ) |
@@ -9,159 +9,159 @@ |
||
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; |
|
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 | 20 | |
21 | - /** |
|
22 | - * Option key, and option page slug |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $screen_id = 'lsx_projects_settings'; |
|
21 | + /** |
|
22 | + * Option key, and option page slug |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $screen_id = 'lsx_projects_settings'; |
|
27 | 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 | - } |
|
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 | 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 | - } |
|
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 | 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 | - } |
|
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 | 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 | - ); |
|
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 | 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 | - ); |
|
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 | 109 | |
110 | - $cmb->add_field( |
|
111 | - array( |
|
112 | - 'id' => 'settings_general_closing', |
|
113 | - 'type' => 'tab_closing', |
|
114 | - ) |
|
115 | - ); |
|
116 | - } |
|
110 | + $cmb->add_field( |
|
111 | + array( |
|
112 | + 'id' => 'settings_general_closing', |
|
113 | + 'type' => 'tab_closing', |
|
114 | + ) |
|
115 | + ); |
|
116 | + } |
|
117 | 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 | - ) |
|
131 | - ); |
|
132 | - $cmb->add_field( |
|
133 | - array( |
|
134 | - 'name' => __( 'Enable contact modal', 'lsx-projects' ), |
|
135 | - 'id' => 'projects_modal_enable', |
|
136 | - 'type' => 'checkbox', |
|
137 | - 'value' => 1, |
|
138 | - 'default' => 0, |
|
139 | - 'description' => __( 'Displays contact modal on project single.', 'lsx-projects' ), |
|
140 | - ) |
|
141 | - ); |
|
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 | + ) |
|
131 | + ); |
|
132 | + $cmb->add_field( |
|
133 | + array( |
|
134 | + 'name' => __( 'Enable contact modal', 'lsx-projects' ), |
|
135 | + 'id' => 'projects_modal_enable', |
|
136 | + 'type' => 'checkbox', |
|
137 | + 'value' => 1, |
|
138 | + 'default' => 0, |
|
139 | + 'description' => __( 'Displays contact modal on project single.', 'lsx-projects' ), |
|
140 | + ) |
|
141 | + ); |
|
142 | 142 | |
143 | - $cmb->add_field( |
|
144 | - array( |
|
145 | - 'name' => __( 'Button label', 'lsx-projects' ), |
|
146 | - 'id' => 'projects_modal_cta_label', |
|
147 | - 'type' => 'text', |
|
148 | - ) |
|
149 | - ); |
|
143 | + $cmb->add_field( |
|
144 | + array( |
|
145 | + 'name' => __( 'Button label', 'lsx-projects' ), |
|
146 | + 'id' => 'projects_modal_cta_label', |
|
147 | + 'type' => 'text', |
|
148 | + ) |
|
149 | + ); |
|
150 | 150 | |
151 | - $cmb->add_field( |
|
152 | - array( |
|
153 | - 'name' => __( 'Caldera Form ID', 'lsx-projects' ), |
|
154 | - 'id' => 'projects_modal_form_id', |
|
155 | - 'type' => 'text', |
|
156 | - ) |
|
157 | - ); |
|
151 | + $cmb->add_field( |
|
152 | + array( |
|
153 | + 'name' => __( 'Caldera Form ID', 'lsx-projects' ), |
|
154 | + 'id' => 'projects_modal_form_id', |
|
155 | + 'type' => 'text', |
|
156 | + ) |
|
157 | + ); |
|
158 | 158 | |
159 | - $cmb->add_field( |
|
160 | - array( |
|
161 | - 'id' => 'settings_contact_modal_closing', |
|
162 | - 'type' => 'tab_closing', |
|
163 | - ) |
|
164 | - ); |
|
165 | - } |
|
159 | + $cmb->add_field( |
|
160 | + array( |
|
161 | + 'id' => 'settings_contact_modal_closing', |
|
162 | + 'type' => 'tab_closing', |
|
163 | + ) |
|
164 | + ); |
|
165 | + } |
|
166 | 166 | |
167 | 167 | } |