Version Description
Download this release
Release Info
Developer | patilvikasj |
Plugin | Lightweight Sidebar Manager |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- classes/class-bsf-sb-loader.php +9 -1
- classes/class-bsf-sb-metabox.php +58 -58
- classes/class-bsf-sb-post-type.php +31 -31
- classes/class-bsf-sb-sidebar.php +8 -6
- classes/class-bsf-sb-white-label.php +5 -5
- classes/modules/target-rule/class-bsf-sb-target-rules-fields.php +321 -159
- includes/white-label.php +4 -6
- languages/{custom-sidebars.pot → sidebar-manager.pot} +81 -55
- readme.txt +11 -6
- sidebar-manager.php +2 -2
classes/class-bsf-sb-loader.php
CHANGED
@@ -36,6 +36,15 @@ if ( ! class_exists( 'BSF_SB_Loader' ) ) {
|
|
36 |
*/
|
37 |
public function __construct() {
|
38 |
$this->load_files();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
/**
|
@@ -45,7 +54,6 @@ if ( ! class_exists( 'BSF_SB_Loader' ) ) {
|
|
45 |
* @return void
|
46 |
*/
|
47 |
private function load_files() {
|
48 |
-
|
49 |
/* Classes */
|
50 |
require_once BSF_SB_DIR . 'classes/modules/target-rule/class-bsf-sb-target-rules-fields.php';
|
51 |
require_once BSF_SB_DIR . 'classes/class-bsf-sb-post-type.php';
|
36 |
*/
|
37 |
public function __construct() {
|
38 |
$this->load_files();
|
39 |
+
|
40 |
+
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Load plugin textdomain.
|
45 |
+
*/
|
46 |
+
public function load_textdomain() {
|
47 |
+
load_plugin_textdomain( 'sidebar-manager' );
|
48 |
}
|
49 |
|
50 |
/**
|
54 |
* @return void
|
55 |
*/
|
56 |
private function load_files() {
|
|
|
57 |
/* Classes */
|
58 |
require_once BSF_SB_DIR . 'classes/modules/target-rule/class-bsf-sb-target-rules-fields.php';
|
59 |
require_once BSF_SB_DIR . 'classes/class-bsf-sb-post-type.php';
|
classes/class-bsf-sb-metabox.php
CHANGED
@@ -54,7 +54,7 @@ if ( ! class_exists( 'BSF_SB_Metabox' ) ) {
|
|
54 |
*/
|
55 |
public function change_post_name_palceholder( $title ) {
|
56 |
if ( get_post_type() == BSF_SB_POST_TYPE ) {
|
57 |
-
$title = __( 'Enter sidebar title here', '
|
58 |
}
|
59 |
return $title;
|
60 |
}
|
@@ -70,7 +70,7 @@ if ( ! class_exists( 'BSF_SB_Metabox' ) ) {
|
|
70 |
remove_meta_box( 'postexcerpt', BSF_SB_POST_TYPE, 'normal' );
|
71 |
|
72 |
/* Target Rule */
|
73 |
-
add_meta_box( 'sidebar-settings', __( 'Sidebar Settings', '
|
74 |
}
|
75 |
|
76 |
/**
|
@@ -134,21 +134,21 @@ if ( ! class_exists( 'BSF_SB_Metabox' ) ) {
|
|
134 |
$replace_sidebar = get_post_meta( $post_id, '_replace_this_sidebar', true );
|
135 |
|
136 |
/* Get Sidebars to show in replace list */
|
137 |
-
$sidebars
|
138 |
-
|
139 |
-
$out
|
140 |
-
$out
|
141 |
-
$out
|
142 |
-
$out
|
143 |
-
$out
|
144 |
-
$out .= '<label>' . esc_html__( 'Sidebar To Replace', '
|
145 |
-
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'Choose which sidebar you want to replace. Select None to disable this sidebar.', '
|
146 |
-
$out
|
147 |
-
$out
|
148 |
|
149 |
if ( ! empty( $sidebars ) ) {
|
150 |
$out .= '<select name="replace_this_sidebar" class="widefat">';
|
151 |
-
$out .= '<option value=""' . selected( $replace_sidebar, '', false ) . '>' . __( 'None', '
|
152 |
|
153 |
foreach ( $sidebars as $slug => $name ) {
|
154 |
if ( strrpos( $slug, BSF_SB_PREFIX ) !== false ) {
|
@@ -158,90 +158,90 @@ if ( ! class_exists( 'BSF_SB_Metabox' ) ) {
|
|
158 |
}
|
159 |
$out .= '</select>';
|
160 |
} else {
|
161 |
-
$out .= '<p>' . __( 'Sidebars are not available.', '
|
162 |
}
|
163 |
|
164 |
$out .= '</td>';
|
165 |
-
$out
|
166 |
-
|
167 |
-
$out
|
168 |
-
$out
|
169 |
-
$out .= '<label>' . esc_html__( 'Description', '
|
170 |
-
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'Add an optional description fot the Widgets screen.', '
|
171 |
-
$out
|
172 |
-
$out
|
173 |
$out .= '<input type="text" rows="1" name="excerpt" value="' . $post->post_excerpt . '">';
|
174 |
// $out .= '<textarea rows="1" name="excerpt">' . $post->post_excerpt . '</textarea>';
|
175 |
$out .= '</td>';
|
176 |
-
$out
|
177 |
|
178 |
-
$out
|
179 |
-
$out
|
180 |
-
$out .= '<label>' . esc_html__( 'Display On', '
|
181 |
-
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'Add locations for where this sidebar should appear.', '
|
182 |
-
$out
|
183 |
-
$out
|
184 |
|
185 |
ob_start();
|
186 |
BSF_SB_Target_Rules_Fields::target_rule_settings_field(
|
187 |
'bsf-sb-location',
|
188 |
array(
|
189 |
-
'title' => __( 'Display Rules', '
|
190 |
'value' => '[{"type":"basic-global","specific":null}]',
|
191 |
'tags' => 'site,enable,target,pages',
|
192 |
'rule_type' => 'display',
|
193 |
-
'add_rule_label' => __( 'Add Display Rule', '
|
194 |
),
|
195 |
$include_locations
|
196 |
);
|
197 |
$out .= ob_get_clean();
|
198 |
-
$out
|
199 |
-
$out
|
200 |
-
|
201 |
-
$out
|
202 |
-
$out
|
203 |
-
$out .= '<label>' . esc_html__( 'Do Not Display On', '
|
204 |
-
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'This Sidebar will not appear at these locations.', '
|
205 |
-
$out
|
206 |
-
$out
|
207 |
ob_start();
|
208 |
BSF_SB_Target_Rules_Fields::target_rule_settings_field(
|
209 |
'bsf-sb-exclusion',
|
210 |
array(
|
211 |
-
'title' => __( 'Exclude On', '
|
212 |
'value' => '[]',
|
213 |
'tags' => 'site,enable,target,pages',
|
214 |
-
'add_rule_label' => __( 'Add Excludion Rule', '
|
215 |
'rule_type' => 'exclude',
|
216 |
),
|
217 |
$exclude_locations
|
218 |
);
|
219 |
$out .= ob_get_clean();
|
220 |
-
$out
|
221 |
-
$out
|
222 |
-
|
223 |
-
$out
|
224 |
-
$out
|
225 |
-
$out .= '<label>' . esc_html__( 'User Roles', '
|
226 |
-
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'Target header based on user role.', '
|
227 |
-
$out
|
228 |
-
$out
|
229 |
ob_start();
|
230 |
BSF_SB_Target_Rules_Fields::target_user_role_settings_field(
|
231 |
'bsf-sb-users',
|
232 |
array(
|
233 |
-
'title' => __( 'Users', '
|
234 |
'value' => '[]',
|
235 |
'tags' => 'site,enable,target,pages',
|
236 |
-
'add_rule_label' => __( 'Add User Rule', '
|
237 |
),
|
238 |
$users
|
239 |
);
|
240 |
$out .= ob_get_clean();
|
241 |
-
$out
|
242 |
-
$out
|
243 |
-
$out
|
244 |
-
$out
|
245 |
|
246 |
echo $out;
|
247 |
}
|
54 |
*/
|
55 |
public function change_post_name_palceholder( $title ) {
|
56 |
if ( get_post_type() == BSF_SB_POST_TYPE ) {
|
57 |
+
$title = __( 'Enter sidebar title here', 'sidebar-manager' );
|
58 |
}
|
59 |
return $title;
|
60 |
}
|
70 |
remove_meta_box( 'postexcerpt', BSF_SB_POST_TYPE, 'normal' );
|
71 |
|
72 |
/* Target Rule */
|
73 |
+
add_meta_box( 'sidebar-settings', __( 'Sidebar Settings', 'sidebar-manager' ), array( $this, 'sidebar_settings' ), BSF_SB_POST_TYPE, 'normal', 'core' );
|
74 |
}
|
75 |
|
76 |
/**
|
134 |
$replace_sidebar = get_post_meta( $post_id, '_replace_this_sidebar', true );
|
135 |
|
136 |
/* Get Sidebars to show in replace list */
|
137 |
+
$sidebars = $this->show_sidebars_to_replace();
|
138 |
+
|
139 |
+
$out = wp_nonce_field( BSF_SB_POST_TYPE, BSF_SB_POST_TYPE . '-nonce', true, false );
|
140 |
+
$out .= '<table class="bsf-sb-table widefat">';
|
141 |
+
$out .= '<tbody>';
|
142 |
+
$out .= '<tr class="bsf-sb-row">';
|
143 |
+
$out .= '<td class="bsf-sb-row-heading">';
|
144 |
+
$out .= '<label>' . esc_html__( 'Sidebar To Replace', 'sidebar-manager' ) . '</label>';
|
145 |
+
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'Choose which sidebar you want to replace. Select None to disable this sidebar.', 'sidebar-manager' ) . '"></i>';
|
146 |
+
$out .= '</td>';
|
147 |
+
$out .= '<td class="bsf-sb-row-content">';
|
148 |
|
149 |
if ( ! empty( $sidebars ) ) {
|
150 |
$out .= '<select name="replace_this_sidebar" class="widefat">';
|
151 |
+
$out .= '<option value=""' . selected( $replace_sidebar, '', false ) . '>' . __( 'None', 'sidebar-manager' ) . '</option>';
|
152 |
|
153 |
foreach ( $sidebars as $slug => $name ) {
|
154 |
if ( strrpos( $slug, BSF_SB_PREFIX ) !== false ) {
|
158 |
}
|
159 |
$out .= '</select>';
|
160 |
} else {
|
161 |
+
$out .= '<p>' . __( 'Sidebars are not available.', 'sidebar-manager' ) . '</p>';
|
162 |
}
|
163 |
|
164 |
$out .= '</td>';
|
165 |
+
$out .= '</tr>';
|
166 |
+
|
167 |
+
$out .= '<tr class="bsf-sb-row">';
|
168 |
+
$out .= '<td class="bsf-sb-row-heading">';
|
169 |
+
$out .= '<label>' . esc_html__( 'Description', 'sidebar-manager' ) . '</label>';
|
170 |
+
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'Add an optional description fot the Widgets screen.', 'sidebar-manager' ) . '"></i>';
|
171 |
+
$out .= '</td>';
|
172 |
+
$out .= '<td class="bsf-sb-row-content">';
|
173 |
$out .= '<input type="text" rows="1" name="excerpt" value="' . $post->post_excerpt . '">';
|
174 |
// $out .= '<textarea rows="1" name="excerpt">' . $post->post_excerpt . '</textarea>';
|
175 |
$out .= '</td>';
|
176 |
+
$out .= '</tr>';
|
177 |
|
178 |
+
$out .= '<tr class="bsf-sb-row">';
|
179 |
+
$out .= '<td class="bsf-sb-row-heading">';
|
180 |
+
$out .= '<label>' . esc_html__( 'Display On', 'sidebar-manager' ) . '</label>';
|
181 |
+
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'Add locations for where this sidebar should appear.', 'sidebar-manager' ) . '"></i>';
|
182 |
+
$out .= '</td>';
|
183 |
+
$out .= '<td class="bsf-sb-row-content">';
|
184 |
|
185 |
ob_start();
|
186 |
BSF_SB_Target_Rules_Fields::target_rule_settings_field(
|
187 |
'bsf-sb-location',
|
188 |
array(
|
189 |
+
'title' => __( 'Display Rules', 'sidebar-manager' ),
|
190 |
'value' => '[{"type":"basic-global","specific":null}]',
|
191 |
'tags' => 'site,enable,target,pages',
|
192 |
'rule_type' => 'display',
|
193 |
+
'add_rule_label' => __( 'Add Display Rule', 'sidebar-manager' ),
|
194 |
),
|
195 |
$include_locations
|
196 |
);
|
197 |
$out .= ob_get_clean();
|
198 |
+
$out .= '</td>';
|
199 |
+
$out .= '</tr>';
|
200 |
+
|
201 |
+
$out .= '<tr class="bsf-sb-row bsf-sb-hidden">';
|
202 |
+
$out .= '<td class="bsf-sb-row-heading">';
|
203 |
+
$out .= '<label>' . esc_html__( 'Do Not Display On', 'sidebar-manager' ) . '</label>';
|
204 |
+
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'This Sidebar will not appear at these locations.', 'sidebar-manager' ) . '"></i>';
|
205 |
+
$out .= '</td>';
|
206 |
+
$out .= '<td class="bsf-sb-row-content">';
|
207 |
ob_start();
|
208 |
BSF_SB_Target_Rules_Fields::target_rule_settings_field(
|
209 |
'bsf-sb-exclusion',
|
210 |
array(
|
211 |
+
'title' => __( 'Exclude On', 'sidebar-manager' ),
|
212 |
'value' => '[]',
|
213 |
'tags' => 'site,enable,target,pages',
|
214 |
+
'add_rule_label' => __( 'Add Excludion Rule', 'sidebar-manager' ),
|
215 |
'rule_type' => 'exclude',
|
216 |
),
|
217 |
$exclude_locations
|
218 |
);
|
219 |
$out .= ob_get_clean();
|
220 |
+
$out .= '</td>';
|
221 |
+
$out .= '</tr>';
|
222 |
+
|
223 |
+
$out .= '<tr class="bsf-sb-row">';
|
224 |
+
$out .= '<td class="bsf-sb-row-heading">';
|
225 |
+
$out .= '<label>' . esc_html__( 'User Roles', 'sidebar-manager' ) . '</label>';
|
226 |
+
$out .= '<i class="bsf-sb-help dashicons dashicons-editor-help" title="' . esc_attr__( 'Target header based on user role.', 'sidebar-manager' ) . '"></i>';
|
227 |
+
$out .= '</td>';
|
228 |
+
$out .= '<td class="bsf-sb-row-content">';
|
229 |
ob_start();
|
230 |
BSF_SB_Target_Rules_Fields::target_user_role_settings_field(
|
231 |
'bsf-sb-users',
|
232 |
array(
|
233 |
+
'title' => __( 'Users', 'sidebar-manager' ),
|
234 |
'value' => '[]',
|
235 |
'tags' => 'site,enable,target,pages',
|
236 |
+
'add_rule_label' => __( 'Add User Rule', 'sidebar-manager' ),
|
237 |
),
|
238 |
$users
|
239 |
);
|
240 |
$out .= ob_get_clean();
|
241 |
+
$out .= '</td>';
|
242 |
+
$out .= '</tr>';
|
243 |
+
$out .= '</tbody>';
|
244 |
+
$out .= '</table>';
|
245 |
|
246 |
echo $out;
|
247 |
}
|
classes/class-bsf-sb-post-type.php
CHANGED
@@ -60,51 +60,51 @@ if ( ! class_exists( 'BSF_SB_Post_Type' ) ) {
|
|
60 |
return;
|
61 |
}
|
62 |
|
63 |
-
$singular
|
64 |
-
$plural
|
65 |
-
$rewrite
|
66 |
'slug' => BSF_SB_POST_TYPE,
|
67 |
);
|
68 |
-
$supports
|
69 |
|
70 |
$labels = array(
|
71 |
-
'name'
|
72 |
-
'singular_name'
|
73 |
-
'menu_name'
|
74 |
-
'add_new'
|
75 |
/* translators: %s singular */
|
76 |
-
'add_new_item'
|
77 |
/* translators: %s singular */
|
78 |
-
'edit_item'
|
79 |
/* translators: %s singular */
|
80 |
-
'new_item'
|
81 |
-
'all_items'
|
82 |
/* translators: %s singular */
|
83 |
-
'view_item'
|
84 |
/* translators: %s plural */
|
85 |
-
'search_items'
|
86 |
/* translators: %s plural */
|
87 |
-
'not_found'
|
88 |
/* translators: %s plural */
|
89 |
-
'not_found_in_trash'
|
90 |
-
'parent_item_colon'
|
91 |
|
92 |
);
|
93 |
$args = array(
|
94 |
-
'labels'
|
95 |
-
'public'
|
96 |
-
'publicly_queryable'
|
97 |
-
'show_ui'
|
98 |
-
'show_in_nav_menus'
|
99 |
-
'show_in_admin_bar'
|
100 |
-
'show_in_menu'
|
101 |
-
'query_var'
|
102 |
-
'rewrite'
|
103 |
-
'capability_type'
|
104 |
-
'has_archive'
|
105 |
-
'hierarchical'
|
106 |
-
'menu_position'
|
107 |
-
'supports'
|
108 |
);
|
109 |
register_post_type( BSF_SB_POST_TYPE, $args );
|
110 |
}
|
60 |
return;
|
61 |
}
|
62 |
|
63 |
+
$singular = __( 'Sidebar', 'sidebar-manager' );
|
64 |
+
$plural = __( 'Sidebars', 'sidebar-manager' );
|
65 |
+
$rewrite = array(
|
66 |
'slug' => BSF_SB_POST_TYPE,
|
67 |
);
|
68 |
+
$supports = array( 'title', 'excerpt' );
|
69 |
|
70 |
$labels = array(
|
71 |
+
'name' => _x( 'Sidebars', 'post type general name', 'sidebar-manager' ),
|
72 |
+
'singular_name' => _x( 'Sidebar', 'post type singular name', 'sidebar-manager' ),
|
73 |
+
'menu_name' => _x( 'Sidebars', 'admin menu', 'sidebar-manager' ),
|
74 |
+
'add_new' => __( 'Add New', 'sidebar-manager' ),
|
75 |
/* translators: %s singular */
|
76 |
+
'add_new_item' => sprintf( __( 'Add New %s', 'sidebar-manager' ), $singular ),
|
77 |
/* translators: %s singular */
|
78 |
+
'edit_item' => sprintf( __( 'Edit %s', 'sidebar-manager' ), $singular ),
|
79 |
/* translators: %s singular */
|
80 |
+
'new_item' => sprintf( __( 'New %s', 'sidebar-manager' ), $singular ),
|
81 |
+
'all_items' => $plural,
|
82 |
/* translators: %s singular */
|
83 |
+
'view_item' => sprintf( __( 'View %s', 'sidebar-manager' ), $singular ),
|
84 |
/* translators: %s plural */
|
85 |
+
'search_items' => sprintf( __( 'Search %s', 'sidebar-manager' ), $plural ),
|
86 |
/* translators: %s plural */
|
87 |
+
'not_found' => sprintf( __( 'No %s Found', 'sidebar-manager' ), $plural ),
|
88 |
/* translators: %s plural */
|
89 |
+
'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'sidebar-manager' ), $plural ),
|
90 |
+
'parent_item_colon' => '',
|
91 |
|
92 |
);
|
93 |
$args = array(
|
94 |
+
'labels' => $labels,
|
95 |
+
'public' => false,
|
96 |
+
'publicly_queryable' => true,
|
97 |
+
'show_ui' => true,
|
98 |
+
'show_in_nav_menus' => false,
|
99 |
+
'show_in_admin_bar' => false,
|
100 |
+
'show_in_menu' => 'themes.php',
|
101 |
+
'query_var' => true,
|
102 |
+
'rewrite' => $rewrite,
|
103 |
+
'capability_type' => 'post',
|
104 |
+
'has_archive' => BSF_SB_POST_TYPE,
|
105 |
+
'hierarchical' => false,
|
106 |
+
'menu_position' => null,
|
107 |
+
'supports' => $supports,
|
108 |
);
|
109 |
register_post_type( BSF_SB_POST_TYPE, $args );
|
110 |
}
|
classes/class-bsf-sb-sidebar.php
CHANGED
@@ -69,8 +69,8 @@ if ( ! class_exists( 'BSF_SB_Sidebar' ) ) {
|
|
69 |
|
70 |
$to_register = get_posts(
|
71 |
array(
|
72 |
-
'post_type'
|
73 |
-
'posts_per_page'
|
74 |
'suppress_filters' => 'false',
|
75 |
)
|
76 |
);
|
@@ -80,9 +80,9 @@ if ( ! class_exists( 'BSF_SB_Sidebar' ) ) {
|
|
80 |
|
81 |
register_sidebar(
|
82 |
array(
|
83 |
-
'name'
|
84 |
-
'id'
|
85 |
-
'description'
|
86 |
)
|
87 |
);
|
88 |
}
|
@@ -131,7 +131,9 @@ if ( ! class_exists( 'BSF_SB_Sidebar' ) ) {
|
|
131 |
continue;
|
132 |
}
|
133 |
|
134 |
-
$
|
|
|
|
|
135 |
|
136 |
if ( isset( $sidebars[ $post_replace_sidebar ] ) && isset( $sidebars[ $sidebar_id ] ) ) {
|
137 |
|
69 |
|
70 |
$to_register = get_posts(
|
71 |
array(
|
72 |
+
'post_type' => BSF_SB_POST_TYPE,
|
73 |
+
'posts_per_page' => -1,
|
74 |
'suppress_filters' => 'false',
|
75 |
)
|
76 |
);
|
80 |
|
81 |
register_sidebar(
|
82 |
array(
|
83 |
+
'name' => $data->post_title,
|
84 |
+
'id' => BSF_SB_PREFIX . '-' . $data->post_name,
|
85 |
+
'description' => $data->post_excerpt,
|
86 |
)
|
87 |
);
|
88 |
}
|
131 |
continue;
|
132 |
}
|
133 |
|
134 |
+
$post_name = isset( $data['post_name'] ) ? $data['post_name'] : '';
|
135 |
+
|
136 |
+
$sidebar_id = BSF_SB_PREFIX . '-' . $post_name;
|
137 |
|
138 |
if ( isset( $sidebars[ $post_replace_sidebar ] ) && isset( $sidebars[ $sidebar_id ] ) ) {
|
139 |
|
classes/class-bsf-sb-white-label.php
CHANGED
@@ -53,9 +53,9 @@ if ( ! class_exists( 'Bsf_Sb_White_Label' ) ) :
|
|
53 |
*/
|
54 |
public function __construct() {
|
55 |
|
56 |
-
add_filter( 'all_plugins'
|
57 |
-
add_filter( 'astra_addon_branding_options'
|
58 |
-
add_action( 'astra_pro_white_label_add_form'
|
59 |
|
60 |
if ( is_admin() ) {
|
61 |
// Display the link with the plugin meta.
|
@@ -145,8 +145,8 @@ if ( ! class_exists( 'Bsf_Sb_White_Label' ) ) :
|
|
145 |
public static function settings( $settings = array() ) {
|
146 |
|
147 |
$settings['bsf-lw-sb'] = array(
|
148 |
-
'name'
|
149 |
-
'description'
|
150 |
);
|
151 |
|
152 |
return $settings;
|
53 |
*/
|
54 |
public function __construct() {
|
55 |
|
56 |
+
add_filter( 'all_plugins', array( $this, 'plugins_page' ) );
|
57 |
+
add_filter( 'astra_addon_branding_options', __CLASS__ . '::settings' );
|
58 |
+
add_action( 'astra_pro_white_label_add_form', __CLASS__ . '::add_white_lavel_form' );
|
59 |
|
60 |
if ( is_admin() ) {
|
61 |
// Display the link with the plugin meta.
|
145 |
public static function settings( $settings = array() ) {
|
146 |
|
147 |
$settings['bsf-lw-sb'] = array(
|
148 |
+
'name' => '',
|
149 |
+
'description' => '',
|
150 |
);
|
151 |
|
152 |
return $settings;
|
classes/modules/target-rule/class-bsf-sb-target-rules-fields.php
CHANGED
@@ -104,6 +104,21 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
104 |
self::$location_selection = self::get_location_selections();
|
105 |
}
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
/**
|
108 |
* Get location selection options.
|
109 |
*
|
@@ -124,51 +139,84 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
124 |
|
125 |
$post_types = apply_filters( 'astra_location_rule_post_types', array_merge( $post_types, $custom_post_type ) );
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
$selection_options = array(
|
128 |
'basic' => array(
|
129 |
-
'label' => __( 'Basic', '
|
130 |
'value' => array(
|
131 |
-
'basic-global' => __( 'Entire Website', '
|
132 |
-
'basic-singulars' => __( 'All Singulars', '
|
133 |
-
'basic-archives' => __( 'All Archives', '
|
134 |
),
|
135 |
),
|
136 |
|
137 |
'special-pages' => array(
|
138 |
-
'label' => __( 'Special Pages', '
|
139 |
-
'value' =>
|
140 |
-
'special-404' => __( '404 Page', 'bsfsidebars' ),
|
141 |
-
'special-search' => __( 'Search Page', 'bsfsidebars' ),
|
142 |
-
'special-blog' => __( 'Blog / Posts Page', 'bsfsidebars' ),
|
143 |
-
'special-front' => __( 'Front Page', 'bsfsidebars' ),
|
144 |
-
'special-date' => __( 'Date Archive', 'bsfsidebars' ),
|
145 |
-
'special-author' => __( 'Author Archive', 'bsfsidebars' ),
|
146 |
-
),
|
147 |
),
|
148 |
);
|
149 |
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
152 |
|
153 |
-
|
154 |
-
|
155 |
-
'object_type' => array( $post_type->name ),
|
156 |
-
);
|
157 |
-
$taxonomies = get_taxonomies( $args, 'objects' );
|
158 |
-
unset( $taxonomies['post_format'] );
|
159 |
|
160 |
-
|
|
|
|
|
|
|
161 |
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
}
|
167 |
|
168 |
$selection_options['specific-target'] = array(
|
169 |
-
'label' => __( 'Specific Target', '
|
170 |
'value' => array(
|
171 |
-
'specifics' => __( 'Specific Pages / Posts / Taxanomies, etc.', '
|
172 |
),
|
173 |
);
|
174 |
|
@@ -183,16 +231,16 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
183 |
public static function get_user_selections() {
|
184 |
$selection_options = array(
|
185 |
'basic' => array(
|
186 |
-
'label' => __( 'Basic', '
|
187 |
'value' => array(
|
188 |
-
'all' => __( 'All', '
|
189 |
-
'logged-in' => __( 'Logged In', '
|
190 |
-
'logged-out' => __( 'Logged Out', '
|
191 |
),
|
192 |
),
|
193 |
|
194 |
'advanced' => array(
|
195 |
-
'label' => __( 'Advanced', '
|
196 |
'value' => array(),
|
197 |
),
|
198 |
);
|
@@ -234,8 +282,13 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
234 |
if ( strpos( $key, 'tax-' ) !== false ) {
|
235 |
$tax_id = (int) str_replace( 'tax-', '', $key );
|
236 |
$term = get_term( $tax_id );
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
|
241 |
return $key;
|
@@ -349,9 +402,16 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
349 |
|
350 |
foreach ( $terms as $term ) {
|
351 |
|
|
|
|
|
352 |
$data[] = array(
|
353 |
'id' => 'tax-' . $term->term_id,
|
354 |
-
'text' => $term->name,
|
|
|
|
|
|
|
|
|
|
|
355 |
);
|
356 |
|
357 |
}
|
@@ -443,7 +503,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
443 |
$type = isset( $settings['type'] ) ? $settings['type'] : 'target_rule';
|
444 |
$class = isset( $settings['class'] ) ? $settings['class'] : '';
|
445 |
$rule_type = isset( $settings['rule_type'] ) ? $settings['rule_type'] : 'target_rule';
|
446 |
-
$add_rule_label = isset( $settings['add_rule_label'] ) ? $settings['add_rule_label'] : __( 'Add Rule', '
|
447 |
$saved_values = $value;
|
448 |
$output = '';
|
449 |
|
@@ -460,7 +520,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
460 |
/* Condition Selection */
|
461 |
$output .= '<div class="target_rule-condition-wrap" >';
|
462 |
$output .= '<select name="' . esc_attr( $input_name ) . '[rule][{{data.id}}]" class="target_rule-condition form-control bsf-sb-input">';
|
463 |
-
$output .= '<option value="">' . __( 'Select', '
|
464 |
|
465 |
foreach ( $selection_options as $group => $group_data ) {
|
466 |
|
@@ -504,34 +564,30 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
504 |
* @param object $post_type post type parameter.
|
505 |
* @param object $taxonomies Taxanomies for creating the target rule markup.
|
506 |
*/
|
507 |
-
public static function get_post_target_rule_options( $post_type, $
|
508 |
|
509 |
$post_key = str_replace( ' ', '-', strtolower( $post_type->label ) );
|
510 |
$post_label = ucwords( $post_type->label );
|
511 |
$post_name = $post_type->name;
|
512 |
$post_option = array();
|
513 |
|
514 |
-
/* translators: %s
|
515 |
-
$all_posts
|
516 |
-
$post_option[ $post_name . '|all' ]
|
517 |
|
518 |
if ( 'pages' != $post_key ) {
|
519 |
-
/* translators: %s percentage */
|
520 |
-
$all_archive = sprintf( __( 'All %s Archive', 'bsfsidebars' ), $post_label );
|
521 |
/* translators: %s post label */
|
|
|
522 |
$post_option[ $post_name . '|all|archive' ] = $all_archive;
|
523 |
-
|
524 |
}
|
525 |
|
526 |
-
|
527 |
-
|
528 |
-
$tax_name = $taxonomy->name;
|
529 |
|
530 |
-
|
531 |
-
|
532 |
|
533 |
-
|
534 |
-
}
|
535 |
|
536 |
$post_output['post_key'] = $post_key;
|
537 |
$post_output['label'] = $post_label;
|
@@ -571,7 +627,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
571 |
$output .= '<span class="target_rule-condition-delete dashicons dashicons-dismiss"></span>';
|
572 |
$output .= '<div class="target_rule-condition-wrap" >';
|
573 |
$output .= '<select name="' . esc_attr( $input_name ) . '[rule][' . $index . ']" class="target_rule-condition form-control bsf-sb-input">';
|
574 |
-
$output .= '<option value="">' . __( 'Select', '
|
575 |
|
576 |
foreach ( $selection_options as $group => $group_data ) {
|
577 |
|
@@ -631,7 +687,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
631 |
if ( 'display' == $type ) {
|
632 |
/* Add new rule */
|
633 |
$output .= '<div class="target_rule-add-exclusion-rule">';
|
634 |
-
$output .= '<a href="#" class="button">' . __( 'Add Exclusion Rule', '
|
635 |
$output .= '</div>';
|
636 |
}
|
637 |
|
@@ -684,7 +740,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
684 |
*/
|
685 |
public function parse_layout_display_condition( $post_id, $rules ) {
|
686 |
|
687 |
-
$
|
688 |
$current_post_type = get_post_type( $post_id );
|
689 |
|
690 |
if ( isset( $rules['rule'] ) && is_array( $rules['rule'] ) && ! empty( $rules['rule'] ) ) {
|
@@ -698,54 +754,60 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
698 |
|
699 |
switch ( $rule_case ) {
|
700 |
case 'basic-global':
|
701 |
-
$
|
702 |
break;
|
703 |
|
704 |
case 'basic-singulars':
|
705 |
if ( is_singular() ) {
|
706 |
-
$
|
707 |
}
|
708 |
break;
|
709 |
|
710 |
case 'basic-archives':
|
711 |
if ( is_archive() ) {
|
712 |
-
$
|
713 |
}
|
714 |
break;
|
715 |
|
716 |
case 'special-404':
|
717 |
if ( is_404() ) {
|
718 |
-
$
|
719 |
}
|
720 |
break;
|
721 |
|
722 |
case 'special-search':
|
723 |
if ( is_search() ) {
|
724 |
-
$
|
725 |
}
|
726 |
break;
|
727 |
|
728 |
case 'special-blog':
|
729 |
if ( is_home() ) {
|
730 |
-
$
|
731 |
}
|
732 |
break;
|
733 |
|
734 |
case 'special-front':
|
735 |
if ( is_front_page() ) {
|
736 |
-
$
|
737 |
}
|
738 |
break;
|
739 |
|
740 |
case 'special-date':
|
741 |
if ( is_date() ) {
|
742 |
-
$
|
743 |
}
|
744 |
break;
|
745 |
|
746 |
case 'special-author':
|
747 |
if ( is_author() ) {
|
748 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
749 |
}
|
750 |
break;
|
751 |
|
@@ -762,7 +824,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
762 |
|
763 |
if ( false !== $post_id && $current_post_type == $post_type ) {
|
764 |
|
765 |
-
$
|
766 |
}
|
767 |
} else {
|
768 |
|
@@ -771,7 +833,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
771 |
$current_post_type = get_post_type();
|
772 |
if ( $current_post_type == $post_type ) {
|
773 |
if ( 'archive' == $archieve_type ) {
|
774 |
-
$
|
775 |
} elseif ( 'taxarchive' == $archieve_type ) {
|
776 |
|
777 |
$obj = get_queried_object();
|
@@ -781,7 +843,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
781 |
}
|
782 |
|
783 |
if ( $current_taxonomy == $taxonomy ) {
|
784 |
-
$
|
785 |
}
|
786 |
}
|
787 |
}
|
@@ -793,17 +855,31 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
793 |
if ( isset( $rules['specific'] ) && is_array( $rules['specific'] ) ) {
|
794 |
foreach ( $rules['specific'] as $specific_page ) {
|
795 |
|
796 |
-
$specific_data
|
|
|
797 |
$specific_post_type = isset( $specific_data[0] ) ? $specific_data[0] : false;
|
798 |
$specific_post_id = isset( $specific_data[1] ) ? $specific_data[1] : false;
|
799 |
if ( 'post' == $specific_post_type ) {
|
800 |
if ( $specific_post_id == $post_id ) {
|
801 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
802 |
}
|
803 |
} elseif ( 'tax' == $specific_post_type ) {
|
804 |
$tax_id = get_queried_object_id();
|
805 |
if ( $specific_post_id == $tax_id ) {
|
806 |
-
$
|
807 |
}
|
808 |
}
|
809 |
}
|
@@ -814,13 +890,13 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
814 |
break;
|
815 |
}
|
816 |
|
817 |
-
if ( $
|
818 |
break;
|
819 |
}
|
820 |
}
|
821 |
}
|
822 |
|
823 |
-
return $
|
824 |
}
|
825 |
|
826 |
/**
|
@@ -836,7 +912,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
836 |
$type = isset( $settings['type'] ) ? $settings['type'] : 'target_rule';
|
837 |
$class = isset( $settings['class'] ) ? $settings['class'] : '';
|
838 |
$rule_type = isset( $settings['rule_type'] ) ? $settings['rule_type'] : 'target_rule';
|
839 |
-
$add_rule_label = isset( $settings['add_rule_label'] ) ? $settings['add_rule_label'] : __( 'Add Rule', '
|
840 |
$saved_values = $value;
|
841 |
$output = '';
|
842 |
|
@@ -853,7 +929,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
853 |
/* Condition Selection */
|
854 |
$output .= '<div class="user_role-condition-wrap" >';
|
855 |
$output .= '<select name="' . esc_attr( $input_name ) . '[{{data.id}}]" class="user_role-condition form-control bsf-sb-input">';
|
856 |
-
$output .= '<option value="">' . __( 'Select', '
|
857 |
|
858 |
foreach ( $selection_options as $group => $group_data ) {
|
859 |
|
@@ -885,7 +961,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
885 |
/* Condition Selection */
|
886 |
$output .= '<div class="user_role-condition-wrap" >';
|
887 |
$output .= '<select name="' . esc_attr( $input_name ) . '[' . $index . ']" class="user_role-condition form-control bsf-sb-input">';
|
888 |
-
$output .= '<option value="">' . __( 'Select', '
|
889 |
|
890 |
foreach ( $selection_options as $group => $group_data ) {
|
891 |
|
@@ -984,6 +1060,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
984 |
if ( null === self::$current_page_type ) {
|
985 |
|
986 |
$page_type = '';
|
|
|
987 |
|
988 |
if ( is_404() ) {
|
989 |
$page_type = 'is_404';
|
@@ -998,11 +1075,14 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
998 |
$page_type = 'is_date';
|
999 |
} elseif ( is_author() ) {
|
1000 |
$page_type = 'is_author';
|
|
|
|
|
1001 |
}
|
1002 |
} elseif ( is_home() ) {
|
1003 |
$page_type = 'is_home';
|
1004 |
} elseif ( is_front_page() ) {
|
1005 |
$page_type = 'is_front_page';
|
|
|
1006 |
} elseif ( is_singular() ) {
|
1007 |
$page_type = 'is_singular';
|
1008 |
$current_id = get_the_id();
|
@@ -1010,7 +1090,8 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
1010 |
$current_id = get_the_id();
|
1011 |
}
|
1012 |
|
1013 |
-
self::$
|
|
|
1014 |
}
|
1015 |
|
1016 |
return self::$current_page_type;
|
@@ -1027,101 +1108,121 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
1027 |
*/
|
1028 |
public function get_posts_by_conditions( $post_type, $option ) {
|
1029 |
|
1030 |
-
if ( is_array( self::$current_page_data ) && isset( self::$current_page_data[ $post_type ] ) ) {
|
1031 |
-
return self::$current_page_data[ $post_type ];
|
1032 |
-
}
|
1033 |
-
|
1034 |
global $wpdb;
|
1035 |
global $post;
|
1036 |
|
1037 |
-
$
|
1038 |
-
$post_type = $post_type ? esc_sql( $post_type ) : esc_sql( $post->post_type );
|
1039 |
-
$current_post_type = esc_sql( get_post_type() );
|
1040 |
-
$current_post_id = false;
|
1041 |
-
$q_obj = get_queried_object();
|
1042 |
|
1043 |
-
|
|
|
|
|
|
|
|
|
1044 |
|
1045 |
self::$current_page_data[ $post_type ] = array();
|
1046 |
|
1047 |
-
$
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1077 |
}
|
1078 |
-
} elseif ( 'is_date' == $current_page_type ) {
|
1079 |
-
$meta_args .= " OR pm.meta_value LIKE '%\"special-date\"%'";
|
1080 |
-
} elseif ( 'is_author' == $current_page_type ) {
|
1081 |
-
$meta_args .= " OR pm.meta_value LIKE '%\"special-author\"%'";
|
1082 |
-
}
|
1083 |
-
break;
|
1084 |
-
case 'is_home':
|
1085 |
-
$meta_args .= " OR pm.meta_value LIKE '%\"special-blog\"%'";
|
1086 |
-
break;
|
1087 |
-
case 'is_front_page':
|
1088 |
-
$current_id = esc_sql( get_the_id() );
|
1089 |
-
$current_post_id = $current_id;
|
1090 |
-
$meta_args .= " OR pm.meta_value LIKE '%\"special-front\"%'";
|
1091 |
-
$meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'";
|
1092 |
-
$meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'";
|
1093 |
-
break;
|
1094 |
-
case 'is_singular':
|
1095 |
-
$current_id = esc_sql( get_the_id() );
|
1096 |
-
$current_post_id = $current_id;
|
1097 |
-
$meta_args .= " OR pm.meta_value LIKE '%\"basic-singulars\"%'";
|
1098 |
-
$meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'";
|
1099 |
-
$meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'";
|
1100 |
-
break;
|
1101 |
-
case '':
|
1102 |
-
$current_post_id = get_the_id();
|
1103 |
-
break;
|
1104 |
-
}
|
1105 |
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
|
|
|
|
|
|
|
|
1110 |
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
'location' => unserialize( $local_post->meta_value ),
|
1116 |
-
);
|
1117 |
-
}
|
1118 |
|
1119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1120 |
|
1121 |
-
|
1122 |
-
|
|
|
|
|
|
|
1123 |
|
1124 |
-
return self::$current_page_data[ $post_type ];
|
1125 |
}
|
1126 |
|
1127 |
/**
|
@@ -1275,7 +1376,7 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
1275 |
$rule_set_titles = '<strong>' . implode( ',', $already_set_rule ) . '</strong>';
|
1276 |
|
1277 |
/* translators: %s post title. */
|
1278 |
-
$notice = sprintf( __( 'The same display setting is already exist in %s post/s.', '
|
1279 |
|
1280 |
echo '<div class="error">';
|
1281 |
echo '<p>' . $notice . '</p>';
|
@@ -1286,6 +1387,67 @@ if ( ! class_exists( 'BSF_SB_Target_Rules_Fields' ) ) {
|
|
1286 |
}
|
1287 |
}
|
1288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1289 |
/**
|
1290 |
* Formated rule meta value to save.
|
1291 |
*
|
104 |
self::$location_selection = self::get_location_selections();
|
105 |
}
|
106 |
|
107 |
+
/**
|
108 |
+
* Get list of post types attached to taxonomies.
|
109 |
+
*
|
110 |
+
* @param string $taxonomy taxonomy name.
|
111 |
+
*
|
112 |
+
* @return array
|
113 |
+
*/
|
114 |
+
public static function sb_get_post_types_by_taxonomy( $taxonomy = '' ) {
|
115 |
+
global $wp_taxonomies;
|
116 |
+
if ( isset( $wp_taxonomies[ $taxonomy ] ) ) {
|
117 |
+
return $wp_taxonomies[ $taxonomy ]->object_type;
|
118 |
+
}
|
119 |
+
return array();
|
120 |
+
}
|
121 |
+
|
122 |
/**
|
123 |
* Get location selection options.
|
124 |
*
|
139 |
|
140 |
$post_types = apply_filters( 'astra_location_rule_post_types', array_merge( $post_types, $custom_post_type ) );
|
141 |
|
142 |
+
$special_pages = array(
|
143 |
+
'special-404' => __( '404 Page', 'sidebar-manager' ),
|
144 |
+
'special-search' => __( 'Search Page', 'sidebar-manager' ),
|
145 |
+
'special-blog' => __( 'Blog / Posts Page', 'sidebar-manager' ),
|
146 |
+
'special-front' => __( 'Front Page', 'sidebar-manager' ),
|
147 |
+
'special-date' => __( 'Date Archive', 'sidebar-manager' ),
|
148 |
+
'special-author' => __( 'Author Archive', 'sidebar-manager' ),
|
149 |
+
);
|
150 |
+
|
151 |
+
if ( class_exists( 'WooCommerce' ) ) {
|
152 |
+
$special_pages['special-woo-shop'] = __( 'WooCommerce Shop Page', 'sidebar-manager' );
|
153 |
+
}
|
154 |
+
|
155 |
$selection_options = array(
|
156 |
'basic' => array(
|
157 |
+
'label' => __( 'Basic', 'sidebar-manager' ),
|
158 |
'value' => array(
|
159 |
+
'basic-global' => __( 'Entire Website', 'sidebar-manager' ),
|
160 |
+
'basic-singulars' => __( 'All Singulars', 'sidebar-manager' ),
|
161 |
+
'basic-archives' => __( 'All Archives', 'sidebar-manager' ),
|
162 |
),
|
163 |
),
|
164 |
|
165 |
'special-pages' => array(
|
166 |
+
'label' => __( 'Special Pages', 'sidebar-manager' ),
|
167 |
+
'value' => $special_pages,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
),
|
169 |
);
|
170 |
|
171 |
+
$args = array(
|
172 |
+
'public' => true,
|
173 |
+
);
|
174 |
+
|
175 |
+
$taxonomies = get_taxonomies( $args, 'objects' );
|
176 |
|
177 |
+
if ( ! empty( $taxonomies ) ) {
|
178 |
+
foreach ( $taxonomies as $taxonomy ) {
|
|
|
|
|
|
|
|
|
179 |
|
180 |
+
// skip post format taxonomy.
|
181 |
+
if ( 'post_format' == $taxonomy->name ) {
|
182 |
+
continue;
|
183 |
+
}
|
184 |
|
185 |
+
$attached_post_types = self::sb_get_post_types_by_taxonomy( $taxonomy->name );
|
186 |
+
|
187 |
+
foreach ( $post_types as $post_type ) {
|
188 |
+
|
189 |
+
if ( ! in_array( $post_type->name, $attached_post_types ) ) {
|
190 |
+
continue;
|
191 |
+
}
|
192 |
+
|
193 |
+
$post_opt = self::get_post_target_rule_options( $post_type, $taxonomy );
|
194 |
+
|
195 |
+
if ( isset( $selection_options[ $post_opt['post_key'] ] ) ) {
|
196 |
+
|
197 |
+
if ( ! empty( $post_opt['value'] ) && is_array( $post_opt['value'] ) ) {
|
198 |
+
|
199 |
+
foreach ( $post_opt['value'] as $key => $value ) {
|
200 |
+
|
201 |
+
if ( ! in_array( $value, $selection_options[ $post_opt['post_key'] ]['value'] ) ) {
|
202 |
+
$selection_options[ $post_opt['post_key'] ]['value'][ $key ] = $value;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
}
|
206 |
+
} else {
|
207 |
+
$selection_options[ $post_opt['post_key'] ] = array(
|
208 |
+
'label' => $post_opt['label'],
|
209 |
+
'value' => $post_opt['value'],
|
210 |
+
);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
}
|
215 |
|
216 |
$selection_options['specific-target'] = array(
|
217 |
+
'label' => __( 'Specific Target', 'sidebar-manager' ),
|
218 |
'value' => array(
|
219 |
+
'specifics' => __( 'Specific Pages / Posts / Taxanomies, etc.', 'sidebar-manager' ),
|
220 |
),
|
221 |
);
|
222 |
|
231 |
public static function get_user_selections() {
|
232 |
$selection_options = array(
|
233 |
'basic' => array(
|
234 |
+
'label' => __( 'Basic', 'sidebar-manager' ),
|
235 |
'value' => array(
|
236 |
+
'all' => __( 'All', 'sidebar-manager' ),
|
237 |
+
'logged-in' => __( 'Logged In', 'sidebar-manager' ),
|
238 |
+
'logged-out' => __( 'Logged Out', 'sidebar-manager' ),
|
239 |
),
|
240 |
),
|
241 |
|
242 |
'advanced' => array(
|
243 |
+
'label' => __( 'Advanced', 'sidebar-manager' ),
|
244 |
'value' => array(),
|
245 |
),
|
246 |
);
|
282 |
if ( strpos( $key, 'tax-' ) !== false ) {
|
283 |
$tax_id = (int) str_replace( 'tax-', '', $key );
|
284 |
$term = get_term( $tax_id );
|
285 |
+
|
286 |
+
if ( ! is_wp_error( $term ) ) {
|
287 |
+
$term_taxonomy = ucfirst( str_replace( '_', ' ', $term->taxonomy ) );
|
288 |
+
return $term->name . ' - ' . $term_taxonomy;
|
289 |
+
} else {
|
290 |
+
return '';
|
291 |
+
}
|
292 |
}
|
293 |
|
294 |
return $key;
|
402 |
|
403 |
foreach ( $terms as $term ) {
|
404 |
|
405 |
+
$term_taxonomy_name = ucfirst( str_replace( '_', ' ', $taxonomy->name ) );
|
406 |
+
|
407 |
$data[] = array(
|
408 |
'id' => 'tax-' . $term->term_id,
|
409 |
+
'text' => $term->name . ' archive page',
|
410 |
+
);
|
411 |
+
|
412 |
+
$data[] = array(
|
413 |
+
'id' => 'tax-' . $term->term_id . '-single-' . $taxonomy->name,
|
414 |
+
'text' => 'All singulars from ' . $term->name,
|
415 |
);
|
416 |
|
417 |
}
|
503 |
$type = isset( $settings['type'] ) ? $settings['type'] : 'target_rule';
|
504 |
$class = isset( $settings['class'] ) ? $settings['class'] : '';
|
505 |
$rule_type = isset( $settings['rule_type'] ) ? $settings['rule_type'] : 'target_rule';
|
506 |
+
$add_rule_label = isset( $settings['add_rule_label'] ) ? $settings['add_rule_label'] : __( 'Add Rule', 'sidebar-manager' );
|
507 |
$saved_values = $value;
|
508 |
$output = '';
|
509 |
|
520 |
/* Condition Selection */
|
521 |
$output .= '<div class="target_rule-condition-wrap" >';
|
522 |
$output .= '<select name="' . esc_attr( $input_name ) . '[rule][{{data.id}}]" class="target_rule-condition form-control bsf-sb-input">';
|
523 |
+
$output .= '<option value="">' . __( 'Select', 'sidebar-manager' ) . '</option>';
|
524 |
|
525 |
foreach ( $selection_options as $group => $group_data ) {
|
526 |
|
564 |
* @param object $post_type post type parameter.
|
565 |
* @param object $taxonomies Taxanomies for creating the target rule markup.
|
566 |
*/
|
567 |
+
public static function get_post_target_rule_options( $post_type, $taxonomy ) {
|
568 |
|
569 |
$post_key = str_replace( ' ', '-', strtolower( $post_type->label ) );
|
570 |
$post_label = ucwords( $post_type->label );
|
571 |
$post_name = $post_type->name;
|
572 |
$post_option = array();
|
573 |
|
574 |
+
/* translators: %s post label */
|
575 |
+
$all_posts = sprintf( __( 'All %s', 'sidebar-manager' ), $post_label );
|
576 |
+
$post_option[ $post_name . '|all' ] = $all_posts;
|
577 |
|
578 |
if ( 'pages' != $post_key ) {
|
|
|
|
|
579 |
/* translators: %s post label */
|
580 |
+
$all_archive = sprintf( __( 'All %s Archive', 'sidebar-manager' ), $post_label );
|
581 |
$post_option[ $post_name . '|all|archive' ] = $all_archive;
|
|
|
582 |
}
|
583 |
|
584 |
+
$tax_label = ucwords( $taxonomy->label );
|
585 |
+
$tax_name = $taxonomy->name;
|
|
|
586 |
|
587 |
+
/* translators: %s taxonomy label */
|
588 |
+
$tax_archive = sprintf( __( 'All %s Archive', 'sidebar-manager' ), $tax_label );
|
589 |
|
590 |
+
$post_option[ $post_name . '|all|taxarchive|' . $tax_name ] = $tax_archive;
|
|
|
591 |
|
592 |
$post_output['post_key'] = $post_key;
|
593 |
$post_output['label'] = $post_label;
|
627 |
$output .= '<span class="target_rule-condition-delete dashicons dashicons-dismiss"></span>';
|
628 |
$output .= '<div class="target_rule-condition-wrap" >';
|
629 |
$output .= '<select name="' . esc_attr( $input_name ) . '[rule][' . $index . ']" class="target_rule-condition form-control bsf-sb-input">';
|
630 |
+
$output .= '<option value="">' . __( 'Select', 'sidebar-manager' ) . '</option>';
|
631 |
|
632 |
foreach ( $selection_options as $group => $group_data ) {
|
633 |
|
687 |
if ( 'display' == $type ) {
|
688 |
/* Add new rule */
|
689 |
$output .= '<div class="target_rule-add-exclusion-rule">';
|
690 |
+
$output .= '<a href="#" class="button">' . __( 'Add Exclusion Rule', 'sidebar-manager' ) . '</a>';
|
691 |
$output .= '</div>';
|
692 |
}
|
693 |
|
740 |
*/
|
741 |
public function parse_layout_display_condition( $post_id, $rules ) {
|
742 |
|
743 |
+
$display = false;
|
744 |
$current_post_type = get_post_type( $post_id );
|
745 |
|
746 |
if ( isset( $rules['rule'] ) && is_array( $rules['rule'] ) && ! empty( $rules['rule'] ) ) {
|
754 |
|
755 |
switch ( $rule_case ) {
|
756 |
case 'basic-global':
|
757 |
+
$display = true;
|
758 |
break;
|
759 |
|
760 |
case 'basic-singulars':
|
761 |
if ( is_singular() ) {
|
762 |
+
$display = true;
|
763 |
}
|
764 |
break;
|
765 |
|
766 |
case 'basic-archives':
|
767 |
if ( is_archive() ) {
|
768 |
+
$display = true;
|
769 |
}
|
770 |
break;
|
771 |
|
772 |
case 'special-404':
|
773 |
if ( is_404() ) {
|
774 |
+
$display = true;
|
775 |
}
|
776 |
break;
|
777 |
|
778 |
case 'special-search':
|
779 |
if ( is_search() ) {
|
780 |
+
$display = true;
|
781 |
}
|
782 |
break;
|
783 |
|
784 |
case 'special-blog':
|
785 |
if ( is_home() ) {
|
786 |
+
$display = true;
|
787 |
}
|
788 |
break;
|
789 |
|
790 |
case 'special-front':
|
791 |
if ( is_front_page() ) {
|
792 |
+
$display = true;
|
793 |
}
|
794 |
break;
|
795 |
|
796 |
case 'special-date':
|
797 |
if ( is_date() ) {
|
798 |
+
$display = true;
|
799 |
}
|
800 |
break;
|
801 |
|
802 |
case 'special-author':
|
803 |
if ( is_author() ) {
|
804 |
+
$display = true;
|
805 |
+
}
|
806 |
+
break;
|
807 |
+
|
808 |
+
case 'special-woo-shop':
|
809 |
+
if ( function_exists( 'is_shop' ) && is_shop() ) {
|
810 |
+
$display = true;
|
811 |
}
|
812 |
break;
|
813 |
|
824 |
|
825 |
if ( false !== $post_id && $current_post_type == $post_type ) {
|
826 |
|
827 |
+
$display = true;
|
828 |
}
|
829 |
} else {
|
830 |
|
833 |
$current_post_type = get_post_type();
|
834 |
if ( $current_post_type == $post_type ) {
|
835 |
if ( 'archive' == $archieve_type ) {
|
836 |
+
$display = true;
|
837 |
} elseif ( 'taxarchive' == $archieve_type ) {
|
838 |
|
839 |
$obj = get_queried_object();
|
843 |
}
|
844 |
|
845 |
if ( $current_taxonomy == $taxonomy ) {
|
846 |
+
$display = true;
|
847 |
}
|
848 |
}
|
849 |
}
|
855 |
if ( isset( $rules['specific'] ) && is_array( $rules['specific'] ) ) {
|
856 |
foreach ( $rules['specific'] as $specific_page ) {
|
857 |
|
858 |
+
$specific_data = explode( '-', $specific_page );
|
859 |
+
|
860 |
$specific_post_type = isset( $specific_data[0] ) ? $specific_data[0] : false;
|
861 |
$specific_post_id = isset( $specific_data[1] ) ? $specific_data[1] : false;
|
862 |
if ( 'post' == $specific_post_type ) {
|
863 |
if ( $specific_post_id == $post_id ) {
|
864 |
+
$display = true;
|
865 |
+
}
|
866 |
+
} elseif ( isset( $specific_data[2] ) && ( 'single' == $specific_data[2] ) && 'tax' == $specific_post_type ) {
|
867 |
+
|
868 |
+
if ( is_singular() ) {
|
869 |
+
$term_details = get_term( $specific_post_id );
|
870 |
+
|
871 |
+
if ( isset( $term_details->taxonomy ) ) {
|
872 |
+
$has_term = has_term( (int) $specific_post_id, $term_details->taxonomy, $post_id );
|
873 |
+
|
874 |
+
if ( $has_term ) {
|
875 |
+
$display = true;
|
876 |
+
}
|
877 |
+
}
|
878 |
}
|
879 |
} elseif ( 'tax' == $specific_post_type ) {
|
880 |
$tax_id = get_queried_object_id();
|
881 |
if ( $specific_post_id == $tax_id ) {
|
882 |
+
$display = true;
|
883 |
}
|
884 |
}
|
885 |
}
|
890 |
break;
|
891 |
}
|
892 |
|
893 |
+
if ( $display ) {
|
894 |
break;
|
895 |
}
|
896 |
}
|
897 |
}
|
898 |
|
899 |
+
return $display;
|
900 |
}
|
901 |
|
902 |
/**
|
912 |
$type = isset( $settings['type'] ) ? $settings['type'] : 'target_rule';
|
913 |
$class = isset( $settings['class'] ) ? $settings['class'] : '';
|
914 |
$rule_type = isset( $settings['rule_type'] ) ? $settings['rule_type'] : 'target_rule';
|
915 |
+
$add_rule_label = isset( $settings['add_rule_label'] ) ? $settings['add_rule_label'] : __( 'Add Rule', 'sidebar-manager' );
|
916 |
$saved_values = $value;
|
917 |
$output = '';
|
918 |
|
929 |
/* Condition Selection */
|
930 |
$output .= '<div class="user_role-condition-wrap" >';
|
931 |
$output .= '<select name="' . esc_attr( $input_name ) . '[{{data.id}}]" class="user_role-condition form-control bsf-sb-input">';
|
932 |
+
$output .= '<option value="">' . __( 'Select', 'sidebar-manager' ) . '</option>';
|
933 |
|
934 |
foreach ( $selection_options as $group => $group_data ) {
|
935 |
|
961 |
/* Condition Selection */
|
962 |
$output .= '<div class="user_role-condition-wrap" >';
|
963 |
$output .= '<select name="' . esc_attr( $input_name ) . '[' . $index . ']" class="user_role-condition form-control bsf-sb-input">';
|
964 |
+
$output .= '<option value="">' . __( 'Select', 'sidebar-manager' ) . '</option>';
|
965 |
|
966 |
foreach ( $selection_options as $group => $group_data ) {
|
967 |
|
1060 |
if ( null === self::$current_page_type ) {
|
1061 |
|
1062 |
$page_type = '';
|
1063 |
+
$current_id = false;
|
1064 |
|
1065 |
if ( is_404() ) {
|
1066 |
$page_type = 'is_404';
|
1075 |
$page_type = 'is_date';
|
1076 |
} elseif ( is_author() ) {
|
1077 |
$page_type = 'is_author';
|
1078 |
+
} elseif ( function_exists( 'is_shop' ) && is_shop() ) {
|
1079 |
+
$page_type = 'is_woo_shop_page';
|
1080 |
}
|
1081 |
} elseif ( is_home() ) {
|
1082 |
$page_type = 'is_home';
|
1083 |
} elseif ( is_front_page() ) {
|
1084 |
$page_type = 'is_front_page';
|
1085 |
+
$current_id = get_the_id();
|
1086 |
} elseif ( is_singular() ) {
|
1087 |
$page_type = 'is_singular';
|
1088 |
$current_id = get_the_id();
|
1090 |
$current_id = get_the_id();
|
1091 |
}
|
1092 |
|
1093 |
+
self::$current_page_data['ID'] = $current_id;
|
1094 |
+
self::$current_page_type = $page_type;
|
1095 |
}
|
1096 |
|
1097 |
return self::$current_page_type;
|
1108 |
*/
|
1109 |
public function get_posts_by_conditions( $post_type, $option ) {
|
1110 |
|
|
|
|
|
|
|
|
|
1111 |
global $wpdb;
|
1112 |
global $post;
|
1113 |
|
1114 |
+
$post_type = $post_type ? esc_sql( $post_type ) : esc_sql( $post->post_type );
|
|
|
|
|
|
|
|
|
1115 |
|
1116 |
+
if ( is_array( self::$current_page_data ) && isset( self::$current_page_data[ $post_type ] ) ) {
|
1117 |
+
return apply_filters( 'astra_get_display_posts_by_conditions', self::$current_page_data[ $post_type ], $post_type );
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
$current_page_type = $this->get_current_page_type();
|
1121 |
|
1122 |
self::$current_page_data[ $post_type ] = array();
|
1123 |
|
1124 |
+
$option['current_post_id'] = self::$current_page_data['ID'];
|
1125 |
+
$meta_header = self::get_meta_option_post( $post_type, $option );
|
1126 |
+
|
1127 |
+
/* Meta option is enabled */
|
1128 |
+
if ( false === $meta_header ) {
|
1129 |
+
|
1130 |
+
$current_post_type = esc_sql( get_post_type() );
|
1131 |
+
$current_post_id = false;
|
1132 |
+
$q_obj = get_queried_object();
|
1133 |
+
|
1134 |
+
$location = isset( $option['location'] ) ? esc_sql( $option['location'] ) : '';
|
1135 |
+
|
1136 |
+
$query = "SELECT p.ID, p.post_name, pm.meta_value FROM {$wpdb->postmeta} as pm
|
1137 |
+
INNER JOIN {$wpdb->posts} as p ON pm.post_id = p.ID
|
1138 |
+
WHERE pm.meta_key = '{$location}'
|
1139 |
+
AND p.post_type = '{$post_type}'
|
1140 |
+
AND p.post_status = 'publish'";
|
1141 |
+
|
1142 |
+
$orderby = ' ORDER BY p.post_date DESC';
|
1143 |
+
|
1144 |
+
/* Entire Website */
|
1145 |
+
$meta_args = "pm.meta_value LIKE '%\"basic-global\"%'";
|
1146 |
+
|
1147 |
+
switch ( $current_page_type ) {
|
1148 |
+
case 'is_404':
|
1149 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"special-404\"%'";
|
1150 |
+
break;
|
1151 |
+
case 'is_search':
|
1152 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"special-search\"%'";
|
1153 |
+
break;
|
1154 |
+
case 'is_archive':
|
1155 |
+
case 'is_tax':
|
1156 |
+
case 'is_date':
|
1157 |
+
case 'is_author':
|
1158 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"basic-archives\"%'";
|
1159 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all|archive\"%'";
|
1160 |
+
|
1161 |
+
if ( 'is_tax' == $current_page_type && ( is_category() || is_tag() || is_tax() ) ) {
|
1162 |
+
|
1163 |
+
if ( is_object( $q_obj ) ) {
|
1164 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all|taxarchive|{$q_obj->taxonomy}\"%'";
|
1165 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"tax-{$q_obj->term_id}\"%'";
|
1166 |
+
}
|
1167 |
+
} elseif ( 'is_date' == $current_page_type ) {
|
1168 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"special-date\"%'";
|
1169 |
+
} elseif ( 'is_author' == $current_page_type ) {
|
1170 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"special-author\"%'";
|
1171 |
+
}
|
1172 |
+
break;
|
1173 |
+
case 'is_home':
|
1174 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"special-blog\"%'";
|
1175 |
+
break;
|
1176 |
+
case 'is_front_page':
|
1177 |
+
$current_id = esc_sql( get_the_id() );
|
1178 |
+
$current_post_id = $current_id;
|
1179 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"special-front\"%'";
|
1180 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'";
|
1181 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'";
|
1182 |
+
break;
|
1183 |
+
case 'is_singular':
|
1184 |
+
$current_id = esc_sql( get_the_id() );
|
1185 |
+
$current_post_id = $current_id;
|
1186 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"basic-singulars\"%'";
|
1187 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"{$current_post_type}|all\"%'";
|
1188 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"post-{$current_id}\"%'";
|
1189 |
+
|
1190 |
+
$taxonomies = get_object_taxonomies( $q_obj->post_type );
|
1191 |
+
$terms = wp_get_post_terms( $q_obj->ID, $taxonomies );
|
1192 |
+
|
1193 |
+
foreach ( $terms as $key => $term ) {
|
1194 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"tax-{$term->term_id}-single-{$term->taxonomy}\"%'";
|
1195 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1196 |
|
1197 |
+
break;
|
1198 |
+
case 'is_woo_shop_page':
|
1199 |
+
$meta_args .= " OR pm.meta_value LIKE '%\"special-woo-shop\"%'";
|
1200 |
+
break;
|
1201 |
+
case '':
|
1202 |
+
$current_post_id = get_the_id();
|
1203 |
+
break;
|
1204 |
+
}
|
1205 |
|
1206 |
+
// Ignore the PHPCS warning about constant declaration.
|
1207 |
+
// @codingStandardsIgnoreStart
|
1208 |
+
$posts = $wpdb->get_results( $query . ' AND (' . $meta_args . ')' . $orderby );
|
1209 |
+
// @codingStandardsIgnoreEnd
|
|
|
|
|
|
|
1210 |
|
1211 |
+
foreach ( $posts as $local_post ) {
|
1212 |
+
self::$current_page_data[ $post_type ][ $local_post->ID ] = array(
|
1213 |
+
'id' => $local_post->ID,
|
1214 |
+
'post_name' => $local_post->post_name,
|
1215 |
+
'location' => unserialize( $local_post->meta_value ),
|
1216 |
+
);
|
1217 |
+
}
|
1218 |
|
1219 |
+
$option['current_post_id'] = $current_post_id;
|
1220 |
+
|
1221 |
+
$this->remove_exclusion_rule_posts( $post_type, $option );
|
1222 |
+
$this->remove_user_rule_posts( $post_type, $option );
|
1223 |
+
}
|
1224 |
|
1225 |
+
return apply_filters( 'astra_get_display_posts_by_conditions', self::$current_page_data[ $post_type ], $post_type );
|
1226 |
}
|
1227 |
|
1228 |
/**
|
1376 |
$rule_set_titles = '<strong>' . implode( ',', $already_set_rule ) . '</strong>';
|
1377 |
|
1378 |
/* translators: %s post title. */
|
1379 |
+
$notice = sprintf( __( 'The same display setting is already exist in %s post/s.', 'sidebar-manager' ), $rule_set_titles );
|
1380 |
|
1381 |
echo '<div class="error">';
|
1382 |
echo '<p>' . $notice . '</p>';
|
1387 |
}
|
1388 |
}
|
1389 |
|
1390 |
+
/**
|
1391 |
+
* Meta option post.
|
1392 |
+
*
|
1393 |
+
* @since 1.0.0
|
1394 |
+
* @param string $post_type Post Type.
|
1395 |
+
* @param array $option meta option name.
|
1396 |
+
*
|
1397 |
+
* @return false | object
|
1398 |
+
*/
|
1399 |
+
static public function get_meta_option_post( $post_type, $option ) {
|
1400 |
+
$page_meta = ( isset( $option['page_meta'] ) && '' != $option['page_meta'] ) ? $option['page_meta'] : false;
|
1401 |
+
|
1402 |
+
if ( false !== $page_meta ) {
|
1403 |
+
$current_post_id = isset( $option['current_post_id'] ) ? $option['current_post_id'] : false;
|
1404 |
+
$meta_id = get_post_meta( $current_post_id, $option['page_meta'], true );
|
1405 |
+
|
1406 |
+
if ( false !== $meta_id && '' != $meta_id ) {
|
1407 |
+
self::$current_page_data[ $post_type ][ $meta_id ] = array(
|
1408 |
+
'id' => $meta_id,
|
1409 |
+
'location' => '',
|
1410 |
+
);
|
1411 |
+
|
1412 |
+
return self::$current_page_data[ $post_type ];
|
1413 |
+
}
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
return false;
|
1417 |
+
}
|
1418 |
+
|
1419 |
+
/**
|
1420 |
+
* Get post selection.
|
1421 |
+
*
|
1422 |
+
* @since 1.0.0
|
1423 |
+
* @param string $post_type Post Type.
|
1424 |
+
*
|
1425 |
+
* @return object Posts.
|
1426 |
+
*/
|
1427 |
+
static public function get_post_selection( $post_type ) {
|
1428 |
+
$query_args = array(
|
1429 |
+
'post_type' => $post_type,
|
1430 |
+
'posts_per_page' => -1,
|
1431 |
+
'post_status' => 'publish',
|
1432 |
+
);
|
1433 |
+
|
1434 |
+
$all_headers = get_posts( $query_args );
|
1435 |
+
$headers = array();
|
1436 |
+
|
1437 |
+
if ( ! empty( $all_headers ) ) {
|
1438 |
+
$headers = array(
|
1439 |
+
'' => __( 'Select', 'sidebar-manager' ),
|
1440 |
+
);
|
1441 |
+
|
1442 |
+
foreach ( $all_headers as $i => $data ) {
|
1443 |
+
|
1444 |
+
$headers[ $data->ID ] = $data->post_title;
|
1445 |
+
}
|
1446 |
+
}
|
1447 |
+
|
1448 |
+
return $headers;
|
1449 |
+
}
|
1450 |
+
|
1451 |
/**
|
1452 |
* Formated rule meta value to save.
|
1453 |
*
|
includes/white-label.php
CHANGED
@@ -9,23 +9,21 @@
|
|
9 |
<li>
|
10 |
<div class="branding-form postbox">
|
11 |
<button type="button" class="handlediv button-link" aria-expanded="true">
|
12 |
-
<span class="screen-reader-text"><?php _e( 'Astra SideBar Branding', '
|
13 |
<span class="toggle-indicator" aria-hidden="true"></span>
|
14 |
</button>
|
15 |
-
|
16 |
<h2 class="hndle ui-sortable-handle">
|
17 |
-
<span><?php _e( 'Astra SideBar Branding', '
|
18 |
</h2>
|
19 |
-
|
20 |
<div class="inside">
|
21 |
<div class="form-wrap">
|
22 |
<div class="form-field">
|
23 |
-
<label><?php _e( 'Plugin Name:', '
|
24 |
<input type="text" name="ast_white_label[bsf-lw-sb][name]" class="placeholder placeholder-active" value="<?php echo esc_attr( $settings['bsf-lw-sb']['name'] ); ?>">
|
25 |
</label>
|
26 |
</div>
|
27 |
<div class="form-field">
|
28 |
-
<label><?php _e( 'Plugin Description:', '
|
29 |
<textarea name="ast_white_label[bsf-lw-sb][description]" class="placeholder placeholder-active" rows="2"><?php echo esc_attr( $settings['bsf-lw-sb']['description'] ); ?></textarea>
|
30 |
</label>
|
31 |
</div>
|
9 |
<li>
|
10 |
<div class="branding-form postbox">
|
11 |
<button type="button" class="handlediv button-link" aria-expanded="true">
|
12 |
+
<span class="screen-reader-text"><?php _e( 'Astra SideBar Branding', 'sidebar-manager' ); ?></span>
|
13 |
<span class="toggle-indicator" aria-hidden="true"></span>
|
14 |
</button>
|
|
|
15 |
<h2 class="hndle ui-sortable-handle">
|
16 |
+
<span><?php _e( 'Astra SideBar Branding', 'sidebar-manager' ); ?></span>
|
17 |
</h2>
|
|
|
18 |
<div class="inside">
|
19 |
<div class="form-wrap">
|
20 |
<div class="form-field">
|
21 |
+
<label><?php _e( 'Plugin Name:', 'sidebar-manager' ); ?>
|
22 |
<input type="text" name="ast_white_label[bsf-lw-sb][name]" class="placeholder placeholder-active" value="<?php echo esc_attr( $settings['bsf-lw-sb']['name'] ); ?>">
|
23 |
</label>
|
24 |
</div>
|
25 |
<div class="form-field">
|
26 |
+
<label><?php _e( 'Plugin Description:', 'sidebar-manager' ); ?>
|
27 |
<textarea name="ast_white_label[bsf-lw-sb][description]" class="placeholder placeholder-active" rows="2"><?php echo esc_attr( $settings['bsf-lw-sb']['description'] ); ?></textarea>
|
28 |
</label>
|
29 |
</div>
|
languages/{custom-sidebars.pot → sidebar-manager.pot}
RENAMED
@@ -1,28 +1,28 @@
|
|
1 |
-
# Copyright (C)
|
2 |
-
# This file is distributed under the same license as the
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: \n"
|
6 |
-
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
-
"X-Generator: grunt-wp-i18n 0.5.4\n"
|
15 |
-
"X-Poedit-KeywordsList: "
|
16 |
-
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
17 |
-
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
18 |
"Language: en\n"
|
19 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
20 |
"X-Poedit-Country: United States\n"
|
21 |
"X-Poedit-SourceCharset: UTF-8\n"
|
|
|
|
|
|
|
22 |
"X-Poedit-Basepath: ../\n"
|
23 |
"X-Poedit-SearchPath-0: .\n"
|
24 |
"X-Poedit-Bookmarks: \n"
|
25 |
"X-Textdomain-Support: yes\n"
|
|
|
26 |
|
27 |
#: classes/class-bsf-sb-metabox.php:57
|
28 |
msgid "Enter sidebar title here"
|
@@ -153,119 +153,145 @@ msgstr ""
|
|
153 |
msgid "No %s Found In Trash"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
157 |
-
|
158 |
-
msgid "Basic"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
162 |
-
msgid "
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
166 |
-
msgid "
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
170 |
-
msgid "
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
174 |
-
msgid "
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
178 |
-
msgid "
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
182 |
-
msgid "
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
186 |
-
|
|
|
187 |
msgstr ""
|
188 |
|
189 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
190 |
-
msgid "
|
191 |
msgstr ""
|
192 |
|
193 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
194 |
-
msgid "
|
195 |
msgstr ""
|
196 |
|
197 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
198 |
-
msgid "
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
|
|
|
|
|
|
|
|
202 |
msgid "Specific Target"
|
203 |
msgstr ""
|
204 |
|
205 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
206 |
msgid "Specific Pages / Posts / Taxanomies, etc."
|
207 |
msgstr ""
|
208 |
|
209 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
210 |
msgid "All"
|
211 |
msgstr ""
|
212 |
|
213 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
214 |
msgid "Logged In"
|
215 |
msgstr ""
|
216 |
|
217 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
218 |
msgid "Logged Out"
|
219 |
msgstr ""
|
220 |
|
221 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
222 |
msgid "Advanced"
|
223 |
msgstr ""
|
224 |
|
225 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
226 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
227 |
msgid "Add Rule"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
231 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
232 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
233 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
|
|
234 |
msgid "Select"
|
235 |
msgstr ""
|
236 |
|
237 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
238 |
-
#. translators: %s
|
239 |
msgid "All %s"
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
243 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
244 |
-
#. translators: %s
|
|
|
245 |
msgid "All %s Archive"
|
246 |
msgstr ""
|
247 |
|
248 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
249 |
msgid "Add Exclusion Rule"
|
250 |
msgstr ""
|
251 |
|
252 |
-
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:
|
253 |
#. translators: %s post title.
|
254 |
msgid "The same display setting is already exist in %s post/s."
|
255 |
msgstr ""
|
256 |
|
257 |
-
#: includes/white-label.php:12 includes/white-label.php:
|
258 |
msgid "Astra SideBar Branding"
|
259 |
msgstr ""
|
260 |
|
261 |
-
#: includes/white-label.php:
|
262 |
msgid "Plugin Name:"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: includes/white-label.php:
|
266 |
msgid "Plugin Description:"
|
267 |
msgstr ""
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
#: classes/class-bsf-sb-post-type.php:71
|
270 |
msgctxt "post type general name"
|
271 |
msgid "Sidebars"
|
1 |
+
# Copyright (C) 2018 Brainstorm Force
|
2 |
+
# This file is distributed under the same license as the Sidebar Manager package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Sidebar Manager 1.0.2\n"
|
6 |
+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/sidebar-manager\n"
|
7 |
+
"POT-Creation-Date: 2018-07-20 07:07:53+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
|
|
|
|
|
|
|
14 |
"Language: en\n"
|
15 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
16 |
"X-Poedit-Country: United States\n"
|
17 |
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
+
"X-Poedit-KeywordsList: "
|
19 |
+
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
20 |
+
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
21 |
"X-Poedit-Basepath: ../\n"
|
22 |
"X-Poedit-SearchPath-0: .\n"
|
23 |
"X-Poedit-Bookmarks: \n"
|
24 |
"X-Textdomain-Support: yes\n"
|
25 |
+
"X-Generator: grunt-wp-i18n1.0.2\n"
|
26 |
|
27 |
#: classes/class-bsf-sb-metabox.php:57
|
28 |
msgid "Enter sidebar title here"
|
153 |
msgid "No %s Found In Trash"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:143
|
157 |
+
msgid "404 Page"
|
|
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:144
|
161 |
+
msgid "Search Page"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:145
|
165 |
+
msgid "Blog / Posts Page"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:146
|
169 |
+
msgid "Front Page"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:147
|
173 |
+
msgid "Date Archive"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:148
|
177 |
+
msgid "Author Archive"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:152
|
181 |
+
msgid "WooCommerce Shop Page"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:157
|
185 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:234
|
186 |
+
msgid "Basic"
|
187 |
msgstr ""
|
188 |
|
189 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:159
|
190 |
+
msgid "Entire Website"
|
191 |
msgstr ""
|
192 |
|
193 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:160
|
194 |
+
msgid "All Singulars"
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:161
|
198 |
+
msgid "All Archives"
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:166
|
202 |
+
msgid "Special Pages"
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:217
|
206 |
msgid "Specific Target"
|
207 |
msgstr ""
|
208 |
|
209 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:219
|
210 |
msgid "Specific Pages / Posts / Taxanomies, etc."
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:236
|
214 |
msgid "All"
|
215 |
msgstr ""
|
216 |
|
217 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:237
|
218 |
msgid "Logged In"
|
219 |
msgstr ""
|
220 |
|
221 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:238
|
222 |
msgid "Logged Out"
|
223 |
msgstr ""
|
224 |
|
225 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:243
|
226 |
msgid "Advanced"
|
227 |
msgstr ""
|
228 |
|
229 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:506
|
230 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:915
|
231 |
msgid "Add Rule"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:523
|
235 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:630
|
236 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:932
|
237 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:964
|
238 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:1439
|
239 |
msgid "Select"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:575
|
243 |
+
#. translators: %s post label
|
244 |
msgid "All %s"
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:580
|
248 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:588
|
249 |
+
#. translators: %s post label
|
250 |
+
#. translators: %s taxonomy label
|
251 |
msgid "All %s Archive"
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:690
|
255 |
msgid "Add Exclusion Rule"
|
256 |
msgstr ""
|
257 |
|
258 |
+
#: classes/modules/target-rule/class-bsf-sb-target-rules-fields.php:1379
|
259 |
#. translators: %s post title.
|
260 |
msgid "The same display setting is already exist in %s post/s."
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: includes/white-label.php:12 includes/white-label.php:16
|
264 |
msgid "Astra SideBar Branding"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: includes/white-label.php:21
|
268 |
msgid "Plugin Name:"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: includes/white-label.php:26
|
272 |
msgid "Plugin Description:"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#. Plugin Name of the plugin/theme
|
276 |
+
msgid "Sidebar Manager"
|
277 |
+
msgstr ""
|
278 |
+
|
279 |
+
#. Plugin URI of the plugin/theme
|
280 |
+
msgid "http://www.brainstormforce.com"
|
281 |
+
msgstr ""
|
282 |
+
|
283 |
+
#. Description of the plugin/theme
|
284 |
+
msgid "This is the plugin to create custom siderbars to your site."
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#. Author of the plugin/theme
|
288 |
+
msgid "Brainstorm Force"
|
289 |
+
msgstr ""
|
290 |
+
|
291 |
+
#. Author URI of the plugin/theme
|
292 |
+
msgid "https://www.brainstormforce.com/"
|
293 |
+
msgstr ""
|
294 |
+
|
295 |
#: classes/class-bsf-sb-post-type.php:71
|
296 |
msgctxt "post type general name"
|
297 |
msgid "Sidebars"
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Lightweight Sidebar Manager ===
|
2 |
Contributors: BrainstormForce
|
3 |
-
Donate link: https://www.
|
4 |
Tags: custom sidebar, sidebar manager, custom widget areas, widgets, conditional sidebar
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -19,8 +19,8 @@ This plugin helps you solve that problem as it allows you to create new sidebars
|
|
19 |
Some of the Features:
|
20 |
|
21 |
1. Create unlimited sidebars
|
22 |
-
2. Place them
|
23 |
-
3.
|
24 |
4. Conditionally display sidebars on specific posts, pages, taxonomies or custom post types
|
25 |
5. Display sidebars based on user roles
|
26 |
|
@@ -51,9 +51,14 @@ Other plugins we found are heavy with ugly interface, non supported, developed o
|
|
51 |
|
52 |
== Changelog ==
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
v1.0.1
|
55 |
* White Label support added from the [Astra Pro](https://wpastra.com/pro/) plugin.
|
56 |
* Optimized target rules query to be even more lightweight.
|
57 |
|
58 |
v1.0.0
|
59 |
-
* Initial release
|
1 |
=== Lightweight Sidebar Manager ===
|
2 |
Contributors: BrainstormForce
|
3 |
+
Donate link: https://www.paypal.me/BrainstormForce
|
4 |
Tags: custom sidebar, sidebar manager, custom widget areas, widgets, conditional sidebar
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 5.1
|
7 |
+
Stable tag: 1.0.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
19 |
Some of the Features:
|
20 |
|
21 |
1. Create unlimited sidebars
|
22 |
+
2. Place them anywhere in your theme that has defined (Footer Widgets / Left or Right Sidebar)
|
23 |
+
3. This plugin works with all well coded themes that have sidebar locations defined.
|
24 |
4. Conditionally display sidebars on specific posts, pages, taxonomies or custom post types
|
25 |
5. Display sidebars based on user roles
|
26 |
|
51 |
|
52 |
== Changelog ==
|
53 |
|
54 |
+
v1.0.2
|
55 |
+
* Improvement: Update target rules with support for targeting all posts inside taxonomies and terms.
|
56 |
+
* Fix: If a taxonomy is used for multiple post types, it was not displayed in target rules.
|
57 |
+
* Fix: Load correct textdomain and allow the plugin to be translated from translate.W.org
|
58 |
+
|
59 |
v1.0.1
|
60 |
* White Label support added from the [Astra Pro](https://wpastra.com/pro/) plugin.
|
61 |
* Optimized target rules query to be even more lightweight.
|
62 |
|
63 |
v1.0.0
|
64 |
+
* Initial release
|
sidebar-manager.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Sidebar Manager
|
4 |
* Plugin URI: http://www.brainstormforce.com
|
5 |
* Description: This is the plugin to create custom siderbars to your site.
|
6 |
-
* Version: 1.0.
|
7 |
* Author: Brainstorm Force
|
8 |
* Author URI: https://www.brainstormforce.com/
|
9 |
* Text Domain: bsfsidebars
|
@@ -25,7 +25,7 @@ define( 'BSF_SB_FILE', __FILE__ );
|
|
25 |
define( 'BSF_SB_BASE', plugin_basename( BSF_SB_FILE ) );
|
26 |
define( 'BSF_SB_DIR', plugin_dir_path( BSF_SB_FILE ) );
|
27 |
define( 'BSF_SB_URL', plugins_url( '/', BSF_SB_FILE ) );
|
28 |
-
define( 'BSF_SB_VER', '1.0.
|
29 |
define( 'BSF_SB_PREFIX', 'bsf-sb' );
|
30 |
define( 'BSF_SB_POST_TYPE', 'bsf-sidebar' );
|
31 |
|
3 |
* Plugin Name: Sidebar Manager
|
4 |
* Plugin URI: http://www.brainstormforce.com
|
5 |
* Description: This is the plugin to create custom siderbars to your site.
|
6 |
+
* Version: 1.0.2
|
7 |
* Author: Brainstorm Force
|
8 |
* Author URI: https://www.brainstormforce.com/
|
9 |
* Text Domain: bsfsidebars
|
25 |
define( 'BSF_SB_BASE', plugin_basename( BSF_SB_FILE ) );
|
26 |
define( 'BSF_SB_DIR', plugin_dir_path( BSF_SB_FILE ) );
|
27 |
define( 'BSF_SB_URL', plugins_url( '/', BSF_SB_FILE ) );
|
28 |
+
define( 'BSF_SB_VER', '1.0.2' );
|
29 |
define( 'BSF_SB_PREFIX', 'bsf-sb' );
|
30 |
define( 'BSF_SB_POST_TYPE', 'bsf-sidebar' );
|
31 |
|