Forums › Forums › Search & Filter Pro › How to set the Custom query to show the filtering on a homepage
- This topic has 8 replies, 2 voices, and was last updated 7 years, 9 months ago by
Trevor.
-
Anonymous(Private) May 16, 2017 at 4:34 pm #109230
Hi there,
I would like to show the filtering on a homepage – so I can’t use shortcodes. This is the website that I’m talking about: http://newpage.lobohr.pl/
Below the numbers section there is an empty div. I would like to put there two dropdown menus where someone can choose a category and a specialisation (tag) and below there should be a table with the output. The design is as follows http://prntscr.com/f8ir8v
Can someone please help me with it? When I select “Custom” and enter the ajax container nothing happens. Also I assume that the results are not screened as a table?
Can I somehow add additional data to a single posts about the localization and salary? Or should I just use meta data and somehow screen it with the plugin?
Thanks in advance for any help,
Regards, Tom
Anonymous(Private) May 17, 2017 at 4:48 pm #109470Oh sorry didn’t know that! Ok now on the homepage I can see the dropdowns and the results but now it’s not working. In the console I’m getting this issue after choosing anything from a dropdown: http://prntscr.com/f8xkpa
Could you please also help me with adding additional fields (like salary and localisation) and showing data in form of a table? Currently all results are without any classes.
Thanks!
Trevor(Private) May 17, 2017 at 5:06 pm #109479You will need to design the HTML for that and edit the results.php template file, using this guide.
Anonymous(Private) May 18, 2017 at 12:26 pm #109668The html code:
<div class="container main-table"> <?php echo do_shortcode( '[searchandfilter id="12"]' ); ?> <table width="100%" border="0" cellpadding="10"> <tbody> <tr class="naglowki-tabeli"> <th scope="col">DATA PUBLIKACJI</th> <th scope="col"><strong>STANOWISKO</strong></th> <th scope="col">LOKALIZACJA</th> <th scope="col">WYNAGRODZENIE BRUTTO</th> <th scope="col"> </th> </tr> <?php echo do_shortcode( '[searchandfilter id="12" show="results"]' ); ?> </tbody> </table> </div>
The results.php code:
<?php if ( $query->have_posts() ) { ?> <?php while ($query->have_posts()) { $query->the_post(); ?> <tr class="pojedynczy-wynik-tabeli"> <td><?php the_date(); ?></td> <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td> <td><?php echo get_post_meta($query->post->ID,"lokalizacja",true); ?></td> <td><?php echo get_post_meta($query->post->ID,"wynagrodzenie_brutto",true); ?></td> <td><a href="<?php the_permalink(); ?>">ZOBACZ</a></td> </tr> <?php } ?> <?php } else { echo "No Results Found"; } ?>
Trevor(Private) May 18, 2017 at 2:35 pm #109692I am thinking the two files should look like this:
<div class="container main-table"> <?php echo do_shortcode( '[searchandfilter id="12"]' ); echo do_shortcode( '[searchandfilter id="12" show="results"]' ); ?> </div>
<?php if ( $query->have_posts() ) { ?> <table width="100%" border="0" cellpadding="10"> <tbody> <tr class="naglowki-tabeli"> <th scope="col">DATA PUBLIKACJI</th> <th scope="col"><strong>STANOWISKO</strong></th> <th scope="col">LOKALIZACJA</th> <th scope="col">WYNAGRODZENIE BRUTTO</th> <th scope="col"> </th> </tr> <?php while ($query->have_posts()) { $query->the_post(); ?> <tr class="pojedynczy-wynik-tabeli"> <td><?php the_date(); ?></td> <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td> <td><?php echo get_post_meta($query->post->ID,"lokalizacja",true); ?></td> <td><?php echo get_post_meta($query->post->ID,"wynagrodzenie_brutto",true); ?></td> <td><a href="<?php the_permalink(); ?>">ZOBACZ</a></td> </tr> <?php } ?> </tbody> </table> <?php } else { echo "No Results Found"; } ?>
-
AuthorPosts