Skip to content

Commit 182604f

Browse files
committed
don't show the navigation if only one section exists
1 parent 85cdbd4 commit 182604f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/class.settings-api.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
/**
44
* weDevs Settings API wrapper class
55
*
6-
* @version 1.2 (18-Oct-2015)
6+
* @version 1.3 (27-Sep-2016)
77
*
88
* @author Tareq Hasan <tareq@weDevs.com>
9-
* @link http://tareq.weDevs.com Tareq's Planet
10-
* @example src/settings-api.php How to use the class
9+
* @link https://tareq.co Tareq Hasan
10+
* @example example/oop-example.php How to use the class
1111
*/
1212
if ( !class_exists( 'WeDevs_Settings_API' ) ):
1313
class WeDevs_Settings_API {
@@ -480,6 +480,13 @@ function get_option( $option, $section, $default = '' ) {
480480
function show_navigation() {
481481
$html = '<h2 class="nav-tab-wrapper">';
482482

483+
$count = count( $this->settings_sections );
484+
485+
// don't show the navigation if only one section exists
486+
if ( $count === 1 ) {
487+
return;
488+
}
489+
483490
foreach ( $this->settings_sections as $tab ) {
484491
$html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title'] );
485492
}
@@ -606,4 +613,5 @@ function(){
606613
}
607614

608615
}
616+
609617
endif;

0 commit comments

Comments
 (0)