diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index cb5ae744..94be599e 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -1288,6 +1288,7 @@ Renders the search form with advanced options (if not disabled in the settings). * **simple:** Set `true` to hide the advanced search options. Default `false`. * **placeholder:** Change the placeholder text. * **type:** Preselect either "any", "story", "chapter", "recommendation", "collection", or "post". +* **expanded:** Whether the advanced form is expanded. Default `false`. * **tags:** Preselect tags as comma-separated list of term IDs. * **genres:** Preselect genres as comma-separated list of term IDs. * **fandoms:** Preselect fandoms as comma-separated list of term IDs. diff --git a/includes/functions/_setup-shortcodes.php b/includes/functions/_setup-shortcodes.php index a1d5f81d..0024e667 100644 --- a/includes/functions/_setup-shortcodes.php +++ b/includes/functions/_setup-shortcodes.php @@ -1378,6 +1378,8 @@ function fictioneer_shortcode_search( $attr ) { $pre_warnings = fictioneer_explode_list( $attr['warnings'] ?? '' ); // Prepare arguments + $args['expanded'] = filter_var( $attr['expanded'] ?? 0, FILTER_VALIDATE_BOOLEAN ); + if ( $simple ) { $args['simple'] = $simple; } diff --git a/searchform.php b/searchform.php index 40d37296..a30e1c4d 100644 --- a/searchform.php +++ b/searchform.php @@ -7,8 +7,10 @@ * @since 5.0.0 * @since 5.11.0 - Added 'fictioneer_search_form_filters' action hook. * @since 5.19.0 - Added taxonomy preselect arguments. + * @since 5.23.1 - Added expanded argument. * * @internal $args['simple'] Optional. Hide advanced options. + * @internal $args['expanded'] Optional. Whether the advanced form should be expanded. Default null|false. * @internal $args['placeholder'] Optional. Change search placeholder. * @internal $args['preselect_type'] Optional. Default post type to query. * @internal $args['preselect_tags'] Optional. Default tag IDs to query. @@ -109,7 +111,13 @@ if ( $show_advanced ) { method="get" class="search-form " action="" - data-advanced="" + data-advanced="" >