-
AuthorSearch Results
-
October 20, 2016 at 12:56 pm #65321
In reply to: Pagination not working
AnonymousInactiveHello Trevor,
sorry for the late reply. Yesterday we were working in other project.We work with a child of Twenty Sixteen theme where we have set new CSS to change all the styles. Also, we have rewritten some templates but we haven’t added or changed too many things. They are more or less the defaults with maybe a new div or something like that.
We have solved one of the two issues we had: Now the pagination is working properly. The problem was that we had defined a div for the search results and we had left out the pagination part. We didn’t know it was necessary to put the pagination inside that div.
So now, we are focused in solve the other question: when something with no results is searched, the results don’t change. They stay as they were after the last query.
If you have anything to help us, just let me know, please.
The page with the filters is here: http://www.gizatea.net.mialias.net/productos-y-serviciosThanks in advance.
October 17, 2016 at 4:27 pm #64552In reply to: Quick help !
AnonymousInactiveThere’s a lot of options as to where you could put it, so it really depends on your theme and how comfortable you are editing it.
It’s worth noting that all the exact code in the FAQ does is show you how to use it. It will just write messages to the browser console, it doesn’t actually fix the problem you’re seeing. You’ll need to have some understanding of the lightbox plugin you’re using and how to reinitiate it after the results are filtered.
To answer you question about where the code goes, if you just want to run some tests, you can place your scripts in the footer.php file for your theme, just above the closing body tag.
After testing, it’s usually best to get your javascript in using the wp_enqueue_script() function. A link below to a pretty good walkthrough of using it.
https://premium.wpmudev.org/blog/adding-scripts-and-styles-wordpress-enqueueing/
Hope it helps.
October 3, 2016 at 5:04 pm #61631In reply to: Invalid argument supplied for foreach() in
RossKeymasterAhhh I had an idea…
If
options
was empty for any of those fields, you would literally get a field with no options on the front end.Perhaps its something to do with a secondary search form you have? Because you can also test for
$sfid==136
for example to ensure the fields you are filtering belong to a specific form only.Anyway, you second question, so you wish to remove child pages from the field?
Then you would do something similar as to above, so instead of converting the ID to post title, you will find and check to see if it has a parent ID, something like:
//https://codex.wordpress.org/Function_Reference/wp_get_post_parent_id $parent_id = wp_get_post_parent_id($option->value); if($parent_id) { //then this option has a parent, so it must be a child }
Taking it further, what you would do is create an empty array of options, then only add the options which don’t have parents to the new array…
Then finally, you replace
options
with the new array, only containing parents.Something like this could work although I didn’t test it –
function filter_input_object($input_object, $sfid) { if($input_object['name'] == ('_sfm_workshop_location' || '_sfm_tour_style' || '_sfm_tour_leader')) { $new_options = array(); //the options added to this will replace all existing optoins in the field foreach($input_object['options'] as $option) { if ($option->value !== "") { //check to see if the option has a parent $parent_id = wp_get_post_parent_id($option->value); if(!$parent_id) { //then this option does not have a parent, so it must be a parent itself, add it to the new array $option->label = get_the_title($option->value); array_push($new_options, $option); } } } //now we have an array with only parent options in, so simply replace the one in the input object $input_object['options'] = $new_options; } return $input_object; }
September 28, 2016 at 7:30 pm #60862In reply to: Design your search & filter form
AnonymousInactiveHello Trevor,
This is the link to the page with the search & filter: http://studio-bianca.nl/de-techniek-ambassadeurs/
I want to change it to the style of the site with font Source Sans Pro, font size a little bit bigger, line-height bigger and the button like the other buttons on the website.
September 2, 2016 at 2:57 pm #56465In reply to: Extra space in search results
AnonymousInactiveThanks, I fixed that. Your plugin still adds extra paragraph tags and br tags.
<?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 * */ 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 style="width:100%;"> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class="result"> <div class="photo"> <?php if (get_field('property_main_image') != '') { ?> <img src="<?php the_field('property_main_image'); ?>" alt="<?php get_field('address'); ?>" /> <?php } else { ?> <img src="/CreativeHomes/wp-content/uploads/2016/08/image-placeholder-500x500.jpg" alt="image coming soon" /> <?php } ?> </div> <div class="status"><?php echo get_field('status'); ?></div> <div class="details"> <?php echo '<h4>$' . get_field('price') . ' </h4>'; echo '<p>' . get_field('address') . '<br>'; echo get_field('city') . ', '; echo get_field('state'); echo get_field('zip') . '</p>'; echo '<p class="spex">' . get_field('bedrooms') . ' BEDROOMS • '; echo get_field('bathrooms') . ' BATHROOMS<br>'; echo '<span class="secondline">' . get_field('square_footage') . ' SQ FT • '; echo get_field('garages') . ' CAR GARAGE</span>'; echo '<span>MLS# ' . get_field('MLS') . '</span></p>';?> <div class="linx"> <a href="#"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_Photos_Grey.png" alt="see photo gallery" /></a> <a target="_blank" href="<?php echo get_field('map_it_link'); ?>"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_MapPin_Grey.png" alt="google map for location" /></a> <a target="_blank" href="<?php echo get_field('download_floorplan'); ?>"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_Collateral_Grey.png" alt="brochure download" /></a> </div><!--end linx--> <a href="<?php echo get_permalink(); ?>"><img src="/CreativeHomes/wp-content/uploads/2016/08/details-button.png" width="122" alt="details" /></a> </div><!--end details--> <div class="interact"> <span><?php the_favorites_button($post_id, $site_id); ?></span> <span><img src="/CreativeHomes/wp-content/uploads/2016/08/check-icon.jpg" />Compare</span> <span><?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>Share</span> <div class="clearfix"> </div> </div><!--end interact--> </div><!--end result--> <?php } ?> </div> <?php } else { echo "No Results Found"; } ?>
September 2, 2016 at 1:50 pm #56455In reply to: Extra space in search results
AnonymousInactive<?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 * */ 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 style="width:100%;"> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class="result"> <?php if (get_field('property_main_image') != '') { ?> <img />" alt="" width="400px" /> <div class="status"><?php echo get_field('status'); ?></div> <div class="details"> <?php echo '<h4>$' . get_field('price') . ' </h4>'; echo '<p>' . get_field('address') . '<br>'; echo get_field('city') . ', '; echo get_field('state'); echo get_field('zip') . '</p>'; echo '<p class="spex">' . get_field('bedrooms') . ' BEDROOMS | '; echo get_field('bathrooms') . ' BATHROOMS<br>'; echo '<span class="secondline">' . get_field('square_footage') . ' SQ FT | '; echo get_field('garages') . ' CAR GARAGE</span>'; echo '<span>MLS# ' . get_field('MLS') . '</span></p>';?> <div class="linx"> <a href="#"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_Photos_Grey.png" alt="see photo gallery" /></a> <a target="_blank">"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_MapPin_Grey.png" alt="google map for location" /></a> <a target="_blank">"><img src="/CreativeHomes/wp-content/uploads/2016/08/CH_Button_Collateral_Grey.png" alt="brochure download" /></a> </div><!--end linx--> <a>"><img src="/CreativeHomes/wp-content/uploads/2016/08/details-button.png" width="122" alt="details" /></a> </div><!--end details--> <div class="interact"> <span><?php the_favorites_button($post_id, $site_id); ?></span> <span><img src="/CreativeHomes/wp-content/uploads/2016/08/check-icon.jpg" />Compare</span> <span><?php if ( function_exists( 'ADDTOANY_SHARE_SAVE_KIT' ) ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>Share</span> </div><!--end interact--> </div><!--end result--> <?php } ?> </div> <?php } else { echo "No Results Found"; } ?>
September 1, 2016 at 11:31 am #56333In reply to: Getting started with styling the results template
TrevorParticipantHere is the ‘starter’ results.php for your Thrive theme:
<?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 * */ 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> <div class="scbgi tt-search-results-posts-container" id="tt-search-results-container"> <?php while ($query->have_posts()) { $query->the_post(); ?> <div class="scc left"> <?php if ( has_post_thumbnail() ) { ?> <a class="rmich" href="<?php the_permalink(); ?>"> <div class="rimc" style="background-image: url(' <?php the_post_thumbnail_url("small");?> ')"></div> </a> <?php } ?> <div class="scbt"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p><br /><?php the_excerpt(); ?></p> <p><?php the_category(); ?></p> <p><?php the_tags(); ?></p> <p><small><?php the_date(); ?></small></p> </div> </div> <?php } ?> </div> 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"; } ?>
Let me know how you get on and if I can close the thread?
TrevorParticipant1. In the S&F CSS you will see this:
.searchandfilter label { display: inline-block; margin: 0; padding: 0; }
And for this element that needs to be:
#search-filter-form-19065 .sf-field-search label { display: block; }
2. Show me a page with buttons you want the style to look like.
August 24, 2016 at 12:11 pm #55492In reply to: customizing search result style
TrevorParticipantA customized results.php for you:
<?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 * */ 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> <ul class="penci-grid"> <?php while ($query->have_posts()) { $query->the_post(); ?> <li class="list-post"> <article id="post-3238" class="item"> <div class="thumbnail"> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("thumb"); echo '</p>'; } ?> </div> <div class="content-list-right content-list-center"> <div class="header-list-style"> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> </div> <div class="item-content"> <p><br /><?php the_excerpt(); ?></p> </div> </div> </article> </li> <?php } ?> </ul> 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"; } ?>
August 5, 2016 at 9:30 am #53533In reply to: ACF custom field, field search bar
TrevorParticipantOK, So I looked. The problem was that you switched off the plugin css and js files and switched on lazyload. I know that the form now looks wrong, but this can be fixed with custom css. However, this messes up the css, so I have fixed that for you. In your Custom CSS, this is the revised S&F section:
.searchandfilter > ul { margin: 0 !important; padding: 0 !important; } .searchandfilter > ul > li { display: inline !important; list-style: none; padding: 0px !important; } .searchandfilter { width:100%; padding:20px; padding-top:50px; } .searchandfilter label { margin-right:16.5px !important; display:inline !important; } .searchandfilter input, select { border-radius:4px; border:0px; height:40px; border-radius: 4px !important; width:23.6% !important; box-sizing: border-box !important; padding: 6px 10px; color: #404040; font: 13px/20px "Open Sans",Helvetica,Arial,sans-serif !important; } .searchandfilter select { background: url(https://onlimaps.be/wp-content/themes/OnliMaps/assets/img/new_arrow.jpg) no-repeat right #fff; -webkit-appearance: none; -moz-appearance: none !important; color: #404040; } form.searchandfilter .sf-field-submit input { color: #fff; background-color: #2479ab; border: 0; padding: 0; } form.searchandfilter .sf-field-submit input:hover { background-color: #105278; transition-duration: 1.1s; }
I have added one line, and added !important to that line and two others.
-
AuthorSearch Results