Skip to content

Commit b6bf42b

Browse files
authored
Register settings to correct sub section (#6)
1 parent d8ffd3c commit b6bf42b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

getdave-responsive-navigation-block.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ function enqueue_block_assets() {
135135
wp_add_inline_style( GDRNB_PLUGIN_SLUG . '-style', $css );
136136
}
137137

138+
138139
function add_settings_page() {
139140
add_options_page(
140141
__( 'Responsive Navigation Block Settings', 'getdave-responsive-navigation-block' ), // Page title
@@ -151,7 +152,7 @@ function settings_page_callback() {
151152
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
152153
<form action="options.php" method="post">
153154
<?php
154-
settings_fields( 'reading' );
155+
settings_fields( GDRNB_PLUGIN_SLUG . '_responsive_nav' ); // Use your custom settings group
155156
do_settings_sections( GDRNB_PLUGIN_SLUG . '_responsive_nav' );
156157
submit_button( __( 'Save Settings', 'getdave-responsive-navigation-block' ) );
157158
?>
@@ -162,22 +163,22 @@ function settings_page_callback() {
162163

163164
function register_settings() {
164165
register_setting(
165-
'reading',
166+
GDRNB_PLUGIN_SLUG . '_responsive_nav', // Custom settings group
166167
GDRNB_PLUGIN_SLUG . '_responsive_nav_breakpoint',
167168
array(
168169
'type' => 'integer',
169-
'description' => __( 'The breakpoint at which the navigation will switch to mobile view', 'getdave-responsive-navigation-block' ),
170+
'description' => __( 'The breakpoint value at which the navigation will switch.', 'getdave-responsive-navigation-block' ),
170171
'sanitize_callback' => 'absint',
171172
'default' => GDRNB_DEFAULT_BREAKPOINT,
172173
)
173174
);
174175

175176
register_setting(
176-
'reading',
177+
GDRNB_PLUGIN_SLUG . '_responsive_nav', // Custom settings group
177178
GDRNB_PLUGIN_SLUG . '_responsive_nav_unit',
178179
array(
179180
'type' => 'string',
180-
'description' => __( 'The unit of the navigation breakpoint', 'getdave-responsive-navigation-block' ),
181+
'description' => __( 'The unit used for the breakpoint.', 'getdave-responsive-navigation-block' ),
181182
'sanitize_callback' => 'sanitize_text_field',
182183
'default' => GDRNB_DEFAULT_UNIT,
183184
)
@@ -207,6 +208,7 @@ function register_settings() {
207208
);
208209
}
209210

211+
210212
function settings_section_callback() {
211213
echo '<p>' . esc_html__( 'Set the breakpoint and unit at which the special Navigation block variations "Desktop Navigation" and "Mobile Navigation" will switch.', 'getdave-responsive-navigation-block' ) . '</p>';
212214
echo '<p>' . esc_html__( '⚠️ Please note: setting this value will have no effect on the standard Navigation block.', 'getdave-responsive-navigation-block' ) . '</p>';

0 commit comments

Comments
 (0)