File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1498,6 +1498,20 @@ private function searchcraft_on_layout_settings_config_request( $request ) {
14981498 update_option ( 'searchcraft_view_all_results_label ' , $ view_all_results_label );
14991499 }
15001500
1501+ // Handle overlay results per page setting.
1502+ if ( isset ( $ request ['searchcraft_overlay_results_per_page ' ] ) ) {
1503+ $ overlay_results_per_page = absint ( wp_unslash ( $ request ['searchcraft_overlay_results_per_page ' ] ) );
1504+
1505+ // Validate the overlay results per page value (between 1 and 20).
1506+ if ( $ overlay_results_per_page < 1 ) {
1507+ $ overlay_results_per_page = 1 ;
1508+ } elseif ( $ overlay_results_per_page > 20 ) {
1509+ $ overlay_results_per_page = 20 ;
1510+ }
1511+
1512+ update_option ( 'searchcraft_overlay_results_per_page ' , $ overlay_results_per_page );
1513+ }
1514+
15011515 // Handle retain get_search_form setting.
15021516 $ retain_get_search_form = isset ( $ request ['searchcraft_retain_get_search_form ' ] ) ? true : false ;
15031517 update_option ( 'searchcraft_retain_get_search_form ' , $ retain_get_search_form );
Original file line number Diff line number Diff line change 3535 $ search_experience = get_option ( 'searchcraft_search_experience ' , 'full ' );
3636 $ include_filter_panel = get_option ( 'searchcraft_include_filter_panel ' , false );
3737 $ results_per_page = get_option ( 'searchcraft_results_per_page ' , 10 );
38+ $ overlay_results_per_page = get_option ( 'searchcraft_overlay_results_per_page ' , 5 );
3839 $ enable_most_recent_toggle = get_option ( 'searchcraft_enable_most_recent_toggle ' , '1 ' );
3940 $ enable_exact_match_toggle = get_option ( 'searchcraft_enable_exact_match_toggle ' , '1 ' );
4041 $ enable_date_range = get_option ( 'searchcraft_enable_date_range ' , '1 ' );
276277 </p>
277278 </td>
278279 </tr>
280+ <tr class="searchcraft-popover-only">
281+ <th scope="row">
282+ <label for="searchcraft_overlay_results_per_page">Results in Overlay</label>
283+ </th>
284+ <td>
285+ <select name="searchcraft_overlay_results_per_page" id="searchcraft_overlay_results_per_page" class="regular-text">
286+ <?php for ( $ i = 1 ; $ i <= 20 ; $ i ++ ) : ?>
287+ <option value="<?php echo esc_attr ( $ i ); ?> " <?php selected ( $ overlay_results_per_page , $ i ); ?> ><?php echo esc_html ( $ i ); ?> </option>
288+ <?php endfor ; ?>
289+ </select>
290+ <p class="description">
291+ Number of search results to display in the modal or inline overlay. Default is 5 results.
292+ </p>
293+ </td>
294+ </tr>
279295 </tbody>
280296 </table>
281297 </div>
Original file line number Diff line number Diff line change @@ -302,7 +302,8 @@ public function get_js_config() {
302302 $ oldest_post_year = $ admin_instance ->get_oldest_post_year ();
303303 $ js_config ['oldestPostYear ' ] = $ oldest_post_year ;
304304
305- $ js_config ['resultsPerPage ' ] = intval ( get_option ( 'searchcraft_results_per_page ' , 10 ) );
305+ $ js_config ['resultsPerPage ' ] = intval ( get_option ( 'searchcraft_results_per_page ' , 10 ) );
306+ $ js_config ['overlayResultsPerPage ' ] = intval ( get_option ( 'searchcraft_overlay_results_per_page ' , 5 ) );
306307
307308 // Filter taxonomies.
308309 $ filter_taxonomies = get_option ( 'searchcraft_filter_taxonomies ' , array () );
Original file line number Diff line number Diff line change 6767 return ;
6868 }
6969 const isWPSearchPage = searchcraft_config . isWPSearchPage || false ;
70+
71+ // Determine which results per page setting to use
72+ // Use overlayResultsPerPage for modal/inline when NOT on search page
73+ // Use regular resultsPerPage for full experience or when on search page
74+ let resultsPerPage = parseInt ( searchcraft_config . resultsPerPage ) || 10 ;
75+ if ( ! isWPSearchPage && searchcraft_config . overlayResultsPerPage ) {
76+ resultsPerPage = parseInt ( searchcraft_config . overlayResultsPerPage ) || 5 ;
77+ }
78+
7079 const config = {
7180 indexName : searchcraft_config . indexName ,
7281 readKey : searchcraft_config . readKey ,
7382 endpointURL : searchcraft_config . endpointURL ,
7483 searchDebounceDelay : 50 ,
75- searchResultsPerPage : parseInt ( searchcraft_config . resultsPerPage ) || 10
84+ searchResultsPerPage : resultsPerPage
7685 } ;
7786
7887 // Add cortexURL if AI summary is enabled
You can’t perform that action at this time.
0 commit comments