From 5f4ea8d0c1322d239b182f196b7a6cc3fd9990fe Mon Sep 17 00:00:00 2001 From: "Rafasashi\\Raphael" Date: Mon, 2 Sep 2024 13:40:55 +0200 Subject: [PATCH] settings updated --- ...ass-wordpress-plugin-template-settings.php | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/includes/class-wordpress-plugin-template-settings.php b/includes/class-wordpress-plugin-template-settings.php index 2c2a575..06e4a42 100644 --- a/includes/class-wordpress-plugin-template-settings.php +++ b/includes/class-wordpress-plugin-template-settings.php @@ -398,37 +398,30 @@ public function settings_section( $section ) { * @return void */ public function settings_page() { - + + // get tab name + $tab = !empty($_GET['tab']) ? sanitize_title($_GET['tab']) : key($this->settings); + // Build page HTML. $html = '
' . "\n"; $html .= '

' . __( 'Plugin Settings', 'wordpress-plugin-template' ) . '

' . "\n"; - $tab = ''; - //phpcs:disable - if ( isset( $_GET['tab'] ) && $_GET['tab'] ) { - - $tab .= sanitize_text_field($_GET['tab']); - } - //phpcs:enable - // Show page tabs. if ( is_array( $this->settings ) && 1 < count( $this->settings ) ) { $html .= '' . "\n"; } + if( $this->settings[$tab]['fields'] ){ + $html .= '
' . "\n"; // Get settings fields. @@ -459,6 +454,8 @@ public function settings_page() { $html .= '' . "\n"; $html .= '

' . "\n"; $html .= '
' . "\n"; + } + $html .= '
' . "\n"; echo wp_kses_normalize_entities($html); //phpcs:ignore