-
AuthorSearch Results
-
September 12, 2019 at 9:39 am #220852
In reply to: How can i only display the filtered results
AnonymousInactiveHi Trevor,
You are totally right. I made a mistake in customizing the results.php
Thanks a lot for checking and pointing in the right direction.
Best regards
September 11, 2019 at 3:34 pm #220782In reply to: Help with displaying result of custom post type
TrevorParticipantAh, OK.
I think you should use our Shortcode method instead. See here and also follow the guide for customising:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/
Then, either edit the results.php file yourself, or contact me and I will edit the results.php file for you. I think the content needs to be like this:
if ( $query->have_posts() ) { ?> <div class="ngo-list"> <div class="table"> <table> <tr> <th>Name</th> <th>Category </th> <th>Website </th> <th>Learn More </th> </tr> <?php while ($query->have_posts()) { $query->the_post(); ?> <tr> <td><h5 class=""><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5></td> <td><?php $term = get_field('ngo_category'); echo get_term($term)->name; ?></td> <td><a href="<?php the_field('website'); ?>"><?php the_field('website'); ?></a></td> <td><a href="<?php the_permalink(); ?>">View Details</a></td> </tr> <?php } echo paginate_links(); } ?> </table> </div> </div> ?>
September 6, 2019 at 3:40 pm #220443In reply to: Custom Sorting is not showing all results
AnonymousInactiveIs tere a way to add my own Query sorting into the functions or results.php?
September 4, 2019 at 2:25 am #220227In reply to: Customizing Results Using Templates
AnonymousInactiveI figured some things out here. Sorry for the pre-mature support request. I figured out that the problem wasn’t with my results.php code, but with the plug-in I was using to regenerate the image sizes. I got a new one and now the page is looking great with some css additions.
August 31, 2019 at 5:47 pm #220104In reply to: Show Excerpt
TrevorParticipantUnless you have edited the results.php file, those are the excerpts. The length of the excerpt is defined by your theme, and must be quite long as that is much longer than usual.
If you write your own excerpts, they will be used instead. The post editor should have a meta field to allow you to write custom excerpts. If you cannot see that field, open the Page Options (at the top of the page towards the right, under the admin bar) and enable them.
August 29, 2019 at 4:14 pm #219973In reply to: Display No Result If No Search String Entered
AnonymousInactiveHi Trevor,
Thanks for the prompt reply, I’ve amended my results.php file as per your suggestion on that other post but I think I’ve done something wrong as no results show now.
This is my code:
if ( $query->have_posts() ) { ?> <?php global $searchandfilter; $sf_current_query = $searchandfilter->get(233)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div>Nothing to see here folks!</div>'; } else { ?> Results code here. <?php} } ?>
Any ideas where I’m going wrong with this?
Thanks,
James
August 28, 2019 at 1:44 pm #219842In reply to: Envira Photo Gallery Thumbnails are not displayed
TrevorParticipantYou are filtering using the envira-tag taxonomy. This is attached to Media posts only, so can you restrict the form to searching just the Media post type:
https://www.screencast.com/t/f4myLKQtEp
Then, in the child theme folder, in the search-filter sub-folder, can you copy the results.php file and name it 727.php?
I will then need to write some custom code for you.
August 21, 2019 at 10:02 am #219414In reply to: Do Not Display Date and Category on Results
TrevorParticipantAs you are using our shortcode method the display of the results comes from our results.php file. You would need to customise it as described (in basic form) here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
You need to remove the lines::
<p><?php the_category(); ?></p> <p><?php the_tags(); ?></p> <p><small><?php the_date(); ?></small></p>
August 21, 2019 at 9:37 am #219404In reply to: Customizing Results
TrevorParticipantHere is the Codex for the_post_thumbnail:
https://developer.wordpress.org/reference/functions/the_post_thumbnail/
You need to change
"small"
to"medium"
In the standard results.php, see lines 56-62 (yours may now be different):
<?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?>
They need the link adding (with an alt to show the caption as a title), like this:
<?php if ( has_post_thumbnail() ) { ?> <a alt="<?php esc_html(get_the_post_thumbnail_caption());?>" href="<?php the_permalink(); ?>"><?php the_post_thumbnail("medium");?></a> <?php } ?>
I *think* that is right. I do not think that
esc_html(get_the_post_thumbnail_caption());
needs to be used with echo.You can use the same to put the caption on the page, like this:
<h3 class="image-caption"><?php esc_html(get_the_post_thumbnail_caption());?></h3>
and to get the description, I think some thing like this:
<div class="image-description> <?php echo get_post(get_post_thumbnail_id())->post_excerpt;?> </div>
You might need paragraph tags around the actual description, inside the div, like this:
<div class="image-description><p> <?php echo get_post(get_post_thumbnail_id())->post_excerpt;?> </p></div>
Let me know if that helps, or doesn’t work?
August 16, 2019 at 10:46 am #219117In reply to: No Results Found With Filter
TrevorParticipantIf you need to modify our results.php template the guide is here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
If you need to output the value of an ACF field, and give it a label, the code shown in this post might help:
You may find other posts with snippets with this forum search:
https://support.searchandfilter.com/forums/search/results.php+acf+get_field/
-
AuthorSearch Results