Forums › Forums › Search & Filter Pro › Help with displaying result of custom post type
- This topic has 8 replies, 2 voices, and was last updated 5 years, 2 months ago by Trevor.
-
Anonymous(Private) September 10, 2019 at 9:36 am #220566
Hi!
Please help, very little knowledge about codding.
I am using Salient WP theme. I made a custom post named certified_ngo with a custom template for it’s archive page. I need help in displaying it’s result with the same template I made and not the default salient template.
How do I go about this? I looked at the documentation and I’m guessing I should set it up using the Custom option https://searchandfilter.com/documentation/search-results/custom/ Is this correct?
It says
-Attach Search & Filter to a query
-Enter the results URL where the query/results will be foundHow do I exactly do those steps? Which php files should I need to edit?
Please help thanks
Trevor(Private) September 11, 2019 at 3:34 pm #220782Ah, 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> ?>
-
AuthorPosts