Skip to content

Commit 0e38e8d

Browse files
committed
Page_slug now working properly.
1 parent dbeef8b commit 0e38e8d

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Modified: Admin-fresh theme to match new WordPress 4.2
77
* Modified: Redux widget now has a proper ID. Thanks @corradomatt!
88
* Modified: Added text-shadow to submenu items to give a stronger "pop"
9+
* Modified: Page_slug now dynamically generated if not specified.
910

1011
## 3.5.2.2
1112
* Modified: Admin blast message pinging server on each load after three day expiration. Possible slow down of the overall panel loading time.

ReduxCore/framework.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,6 @@ public function __construct( $sections = array(), $args = array(), $extra_tabs =
242242
*/
243243
$this->args = apply_filters( "redux/options/{$this->args['opt_name']}/args", $this->args );
244244

245-
if ( Redux_Helpers::isLocalHost() || ( defined( 'WP_DEBUG' ) && WP_DEBUG == true ) ) {
246-
$this->args['dev_mode'] = true;
247-
}
248-
249245
// Do not save the defaults if we're on a live preview!
250246
if ( $GLOBALS['pagenow'] == "customize" && isset( $_GET['theme'] ) && ! empty( $_GET['theme'] ) ) {
251247
$this->args['save_defaults'] = false;
@@ -460,7 +456,7 @@ private function set_default_args() {
460456
// menu title/text
461457
'page_title' => '',
462458
// option page title
463-
'page_slug' => '_options',
459+
'page_slug' => '',
464460
'page_permissions' => 'manage_options',
465461
'menu_type' => 'menu',
466462
// ('menu'|'submenu')
@@ -1224,6 +1220,25 @@ private function _default_cleanup() {
12241220
if ( $this->args['global_variable'] == "" && $this->args['global_variable'] !== false ) {
12251221
$this->args['global_variable'] = str_replace( '-', '_', $this->args['opt_name'] );
12261222
}
1223+
1224+
// Force dev_mode on WP_DEBUG = true and if it's a local server
1225+
if ( Redux_Helpers::isLocalHost() || ( defined( 'WP_DEBUG' ) && WP_DEBUG == true ) ) {
1226+
$this->args['dev_mode'] = true;
1227+
}
1228+
1229+
// Auto create the page_slug appropriately
1230+
if ( empty( $this->args['page_slug'] ) ) {
1231+
if ( ! empty( $this->args['display_name'] ) ) {
1232+
$this->args['page_slug'] = sanitize_html_class( $this->args['display_name'] );
1233+
} else if ( ! empty( $this->args['page_title'] ) ) {
1234+
$this->args['page_slug'] = sanitize_html_class( $this->args['page_title'] );
1235+
} else if ( ! empty( $this->args['menu_title'] ) ) {
1236+
$this->args['page_slug'] = sanitize_html_class( $this->args['menu_title'] );
1237+
} else {
1238+
$this->args['page_slug'] = str_replace( '-', '_', $this->args['opt_name'] );
1239+
}
1240+
}
1241+
12271242
}
12281243

12291244
/**

readme.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,14 @@ That's because the real FAQ section is on our site! Please visit [http://docs.re
131131
* Modified: Admin-fresh theme to match new WordPress 4.2
132132
* Modified: Redux widget now has a proper ID. Thanks @corradomatt!
133133
* Modified: Added text-shadow to submenu items to give a stronger "pop"
134+
* Modified: Page_slug now dynamically generated if not specified.
134135
* Modified: Admin blast message pinging server on each load after three day expiration. Possible slow down of the overall panel loading time.
135136
* Fixed: #2221 - Background field media not enqueueing when used with no other media based fields.
136137
* Fixed: #2214: Bad path for import/export enqueue.
137138
* Release: Wp.org release.
138139
* Fixed: #2214 - Import/export field contained bad enqueue path.
139140
* Modified: If running localhost or WP_DEBUG is set to true, Redux dev_mode is forced to true.
141+
* Modified: Page_slug now dynamically generated if not specified.
140142

141143
= 3.5.1 =
142144
* Modified: Redux News dashboard widget appears only when dev_mode is true or in a local host environment.

sample/sample-config-legacy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,8 +1708,8 @@ public function setArguments() {
17081708
// Force your panel to always open to a specific tab (by id)
17091709
'page_icon' => 'icon-themes',
17101710
// Icon displayed in the admin panel next to your menu_title
1711-
'page_slug' => '_options',
1712-
// Page slug used to denote the panel
1711+
'page_slug' => '',
1712+
// Page slug used to denote the panel, will be based off page title then menu title then opt_name if not provided
17131713
'save_defaults' => true,
17141714
// On load save the defaults to DB before user clicks save or not
17151715
'default_show' => false,

sample/sample-config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@
136136
// Force your panel to always open to a specific tab (by id)
137137
'page_icon' => 'icon-themes',
138138
// Icon displayed in the admin panel next to your menu_title
139-
'page_slug' => '_options',
140-
// Page slug used to denote the panel
139+
'page_slug' => '',
140+
// Page slug used to denote the panel, will be based off page title then menu title then opt_name if not provided
141141
'save_defaults' => true,
142142
// On load save the defaults to DB before user clicks save or not
143143
'default_show' => false,

0 commit comments

Comments
 (0)