Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro How to set the Custom query to show the filtering on a homepage

Viewing 9 posts - 1 through 9 (of 9 total)
  • Trevor Moderator
    #109462

    What theme are you using, and why would the shortcode method not work? If you have access to the home page template php file, you could put both the form and results in as php do_shortcode() functions.

    Tomasz
    #109470

    Oh 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 Moderator
    #109472

    Is this a custom theme you have made?

    That error code is for jQuery 3.1.1 (do you need that version)? Whereas WP uses 1.12.4 (which you also have loading).

    Tomasz
    #109474

    Yes it is.

    Thanks for help Trevor, I don’t know why there was a line with the old jQuery version. Changing it made the plugin work.

    Any help with the table?

    Trevor Moderator
    #109479

    You will need to design the HTML for that and edit the results.php template file, using this guide.

    Tomasz
    #109666

    Trevor thank you for your help. I did as you said and now I encountered an issue here:

    http://newpage.lobohr.pl/

    once you choose anything from the dropdown, the results instead of update the table are shown below the dropdowns itself. Can you please help me with this?

    Tomasz
    #109668

    The 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">&nbsp;</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 Moderator
    #109692

    I 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">&nbsp;</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";
    }
    ?>
Viewing 9 posts - 1 through 9 (of 9 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.