Forums › Forums › Search & Filter Pro › Is it possible to start the search form with no results?
Tagged: Checkbox Result
- This topic has 18 replies, 2 voices, and was last updated 7 years, 10 months ago by Trevor.
-
Anonymous(Private) December 29, 2016 at 1:12 pm #79128
Hallo all together,
I need to use my search form as follows:
When i start my item page there must no result on the page.
When i select a checkbox the resuls have to be displayed.
When deselekt all checkboxes there also must be no results.
Is such a behavior possible?Many thanks
Hans-PeterTrevor(Private) December 29, 2016 at 7:49 pm #79193OK, if you have followed the documentation to make a copy of the results.php into a new folder called
search-filter
in your child theme or theme folder, then replace the contents of that template file with this (change the number255
for the ID number of your search form and change the lineecho '<div>Nothing to see here folks!</div>';
for whatever you want before the filter is used instead of the results – or remove for nothing at all):<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link http://www.designsandcode.com/ * @copyright 2015 Designs & Code * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ global $searchandfilter; $sf_current_query = $searchandfilter->get(255)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div>Nothing to see here folks!</div>'; } else { if ( $query->have_posts() ) { ?> Found <?php echo $query->found_posts; ?> Results<br /> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php while ($query->have_posts()) { $query->the_post(); ?> <div> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p><br /><?php the_excerpt(); ?></p> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> <p><?php the_category(); ?></p> <p><?php the_tags(); ?></p> <p><small><?php the_date(); ?></small></p> </div> <hr /> <?php } ?> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php } else { echo "No Results Found"; } } ?>
Anonymous(Private) January 3, 2017 at 12:17 pm #79694Many thanks for your quick answer.
It works very well.
But now i have one more Question. If there is a shotcut in the output it is not resolved.
Do you have a resolution for me like;// Do ShortCodes in ShortCode Routines add_filter('widget_text', 'do_shortcode');
ore sth. else?
Many thanks and regards
Hans-PeterTrevor(Private) January 4, 2017 at 11:09 am #79870I am not aware of a filter that would do that within S&F Pro. Is it shortcodes from a specfic plugin, or all shortcodes? I wonder because it may be that the shortcode in question is not defined before S&F Pro produces the results.
Is the shortcode in question inside an excerpt or the full post content. In which case, this might help:
http://wordpress.stackexchange.com/questions/42743/the-excerpt-and-shortcodes
Anonymous(Private) January 4, 2017 at 12:30 pm #79882Sorry, but the hints on your link do not work.
The output is like this:[et_pb_section admin_label=“section“][et_pb_row admin_label=“row“][et_pb_column type=“4_4″][et_pb_text admin_label=“Text“ background_layout=“light“ text_orientation=“left“ use_border_color=“off“ border_color=“#ffffff“ border_style=“solid“] Projektmanagement Prüfung In einer sich ständig wandelnden Welt
Reloading the page it looks like:
<div class="popmake-2303 data-do-default= pum-trigger" "="" style="cursor: pointer;"> <h1 style="text-align: center;">QW – Projektmanagement Prüfung</h1> <p style="text-align: center;"></p> <div class="et_pb_section et_pb_section_3 et_section_regular"></div> <!-- .et_pb_section --> <div class=" et_pb_row et_pb_row_3 et_pb_row_empty"></div> <!-- .et_pb_row --> <div class="et_pb_column et_pb_column_4_4 et_pb_column_3 et_pb_column_empty"></div> <!-- .et_pb_column --><div class="et_pb_text et_pb_module et_pb_bg_layout_light et_pb_text_align_left et_pb_text_2"></div> <!-- .et_pb_text --> Projektmanagement Prüfung In einer sich ständig wandelnden Welt </div>
-
AuthorPosts