From 1254b378a274c04b62e31e377f9f7e2c92aefac5 Mon Sep 17 00:00:00 2001 From: matheusgimenez Date: Wed, 26 Jul 2017 16:30:37 -0300 Subject: [PATCH] =?UTF-8?q?resolvendo=20coisas=20da=20se=C3=A7=C3=A3o=20po?= =?UTF-8?q?rtfolio=20no=20customizer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/customizer.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/inc/customizer.php b/inc/customizer.php index 318afd5..4d7d81d 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -2865,7 +2865,19 @@ function coletivo_showon_frontpage() { function coletivo_is_jetpack_active() { return is_page_template( 'template-frontpage.php' ) && class_exists( 'Jetpack' ); } - +/** + * Remove deactivated sections + * @param array $sections + * @return array + */ +function coletivo_remove_deactivated_sections( $sections ) { + if ( in_array( 'portfolio', $sections ) && ! coletivo_is_jetpack_active() ) { + $key = array_search( 'portfolio', $sections ); + unset( $sections[ $key ] ); + } + return $sections; +} +add_filter( 'coletivo_frontpage_sections_order', 'coletivo_remove_deactivated_sections', 9999 ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */