From 04ec005eb647246a418be8c035f9e5b29abf63ee Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Thu, 17 Nov 2022 17:06:41 +1000 Subject: [PATCH] Expand a code block by default if it has the 'expanded' CSS class. --- .../themes/wporg-developer/js/function-reference.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/wp-content/themes/wporg-developer/js/function-reference.js b/source/wp-content/themes/wporg-developer/js/function-reference.js index a32f29a88..ef24ed336 100644 --- a/source/wp-content/themes/wporg-developer/js/function-reference.js +++ b/source/wp-content/themes/wporg-developer/js/function-reference.js @@ -77,7 +77,12 @@ jQuery( function ( $ ) { } } ); - collapseCodeBlock( $element, $expandButton ); + if ( $element.hasClass( 'expanded' ) ) { + expandCodeBlock( $element, $expandButton ); + } else { + collapseCodeBlock( $element, $expandButton ); + } + $container.append( $expandButton ); }