Forums Forums Search & Filter Pro Results are not displaying

Viewing 10 posts - 1 through 10 (of 10 total)
  • Anonymous
    #226105

    Hi,

    I am using a custom post type. I want to add the filter & search tools on the archive-journal.php page. The post type is called ‘journal’. Below, is my code for archive-journal.php:

    <?php echo do_shortcode('[searchandfilter id="1843"]'); ?>
      <?php echo do_shortcode('[searchandfilter id="1843" show="results"]'); ?>
    
    <?php
    if ( have_posts() ) {
    	while ( have_posts() ) {
    		the_post(); ?>
    <div class="row">
    
    <div class="col-lg-2">
    <!-- url -->
    <a href="<?php echo esc_url(the_field('url_journal')); ?>">Pdf link</a>
    </div>
    
    <div class="col-lg-3">
    <!-- title -->
    <?php	the_title(); ?>
    </div>
    
    <div class="col-lg-1">
    <!-- name -->
    <?php the_field('first_name_journal'); ?>
    <?php the_field('surname_journal'); ?>
    </div>
    
    <div class="col-lg-1">
    <!-- volume -->
    <?php the_field('volume'); ?>
    </div>
    
    <div class="col-lg-1">
    <!-- part -->
    <?php the_field('part_journal'); ?>
    </div>
    
    <div class="col-lg-1">
    <!-- month -->
    <?php the_field('month_journal'); ?>
    </div>
    
    <div class="col-lg-1">
    <!-- year -->
    <?php the_field('year_journal'); ?>
    </div>
    
    <div class="col-lg-2">
    <!-- keywords/tags -->
    <?php $post_tags = get_the_tags();
    
    if ( $post_tags ) {
        foreach( $post_tags as $tag ) {
        echo $tag->name . ', ';
        }
    } ?>
    </div>
    
    </div> <!-- close row -->
    
      <?php } // end while
    } // end if
    ?>
    

    In the settings for the plugin I have selected the following:

    – General > Search in the following post types > Journal
    – General > choose which kind of pages S & F will try to do this on > post type archives
    – General > Search form UI > I have added ‘search’ & ‘tag’.

    – Display results > Display results method: > Using a shortcode
    – Display results > Template options > I have pasted in the url of the archive-journal.php on the
    site.

    – Posts > Post status > published

    It displays ‘no results found’ & then lists all the journal posts below (which haven’t been filtered).

    How can I fix this, please?

    Trevor
    #226110
    This reply has been marked as private.
    Anonymous
    #226209

    Hi Trevor,

    Thanks for the reply.

    OK. So I’m using a custom post type called ‘journal’. I would like to filter the archive page for this. The archive-journal.php file is below.

    If it’s useful to speak with me, I’m in the UK

    Thank you very much for your time, & have a good week.

    Archive-journal.php:

    <?php get_header(); ?>
    
    <div class="container">
    
      <?php echo do_shortcode('[searchandfilter id="1928"]'); ?>
    
    <div class="journal-desktop-tables-gvs">
      <div class="row  journal-columns-gvs-row">
            <div class="col-xl-1 col-lg-3 col-md-3  d-none d-xl-block col-sm-3 col-xs-3 journal-columns-gvs-title">
      <!-- url -->
    <b>Link </b>
      </div>
    
      <div class="col-xl-3 d-none d-xl-block col-lg-6 col-md-6  col-sm-6 col-xs-6 journal-columns-gvs-title">
      <!-- title -->
      <b> Title </b>
      </div>
    
      <div class="col-xl-2 d-none d-xl-block col-lg-3 col-md-3  col-sm-3 col-xs-3 journal-columns-gvs-title">
      <!-- name -->
      <b> Author </b>
      </div>
    
      <div class="col-xl-1  d-none d-xl-block journal-columns-gvs-title journal-small-screen-hide">
      <!-- volume -->
      <b> Volume</b>
      </div>
    
      <div class="col-xl-1 d-none d-xl-block journal-columns-gvs-title journal-small-screen-hide">
      <!-- part -->
        <b> Part </b>
      </div>
    
      <div class="col-xl-1  d-none d-xl-block journal-columns-gvs-title journal-small-screen-hide">
      <!-- month -->
      <b> Month </b>
      </div>
    
      <div class="col-xl-1 d-none d-xl-block  journal-columns-gvs-title journal-small-screen-hide">
      <!-- year -->
        <b> Year </b>
      </div>
    
      <div class="col-xl-2  d-none d-xl-block journal-columns-gvs-title journal-small-screen-hide">
      <!-- keywords/tags -->
      <b> Keywords/Tags </b>
      </div>
    
    </div> <!-- close row -->
    </div> <!-- close journal-desktop-tables-gvs -->
    
    <?php $c = 0; ?>
    <?php
    if ( have_posts() ) {
    	while ( have_posts() ) {
    		the_post(); $c++;
    
        $data_target_collapsable_with_hash_gvs = '#'. get_the_ID(); //data target with hash
        $data_target_collapsable_without_hash_gvs = get_the_ID();   // data id without hash
        $data_aria_labelleby_heading_gvs = 'heading' . get_the_ID(); // aria-labelledby
      //  echo  ' ID with hash:' . $data_target_collapsable_with_hash_gvs;
        //    echo  ' ID withOUT hash:' . $data_target_collapsable_without_hash_gvs;
        //    echo ' Arialabelledby:' . $data_aria_labelleby_heading_gvs;
        ?>
    
    <div class="row journal-columns-results-gvs">
    
    <div class="col-xl-1  col-lg-3 col-md-3  col-sm-3 col-xs-3 journal-columns-gvs">
    <!-- url -->
    <div class="mobile-only-journal-title-gvs"> LINK </div>
    <a href="<?php echo esc_url(the_field('url_journal')); ?>">Pdf link</a>
    </div>
    
    <div class="col-xl-3 col-lg-6 col-md-6  col-sm-6 col-xs-6 journal-columns-gvs">
    <!-- title -->
    <div class="mobile-only-journal-title-gvs"> TITLE </div>
    <?php	the_title(); ?>
    </div>
    
    <div class="col-xl-2 col-lg-3 col-md-3  col-sm-3 col-xs-3 journal-columns-gvs">
    <!-- name -->
    <div class="mobile-only-journal-title-gvs"> AUTHOR </div>
    <?php the_field('first_name_journal'); ?>
    <?php the_field('surname_journal'); ?>
    </div>
    
    <!-- accordian start 1 -->
    <div id="accordion">
      <div class="card">
        <div class="card-header" id="heading-<?php the_ID(); ?>">
          <h5 class="mb-0">
            <button class="btn btn-link" data-toggle="collapse" data-target="#collapse-<?php the_ID(); ?>" aria-expanded="false" aria-controls="collapse-<?php the_ID(); ?>" id="collapsetbn">
             <span class="not-collapsed-gvs"> See more information - click here </span>        <span class="collapsed-gvs"> See less information </span>
            </button>
          </h5>
        </div>
    
        <div id="collapse-<?php the_ID(); ?>" class="collapse closed" aria-labelledby="heading-<?php the_ID(); ?>" data-parent="#accordion">
          <div class="card-body">
    
    <!-- accordian end 1 -->
    
    <div class="col-xl-1 col-lg-3 col-md-3  col-sm-3 col-xs-3 journal-columns-gvs ">
    <!-- volume -->
    <div class="mobile-only-journal-title-gvs"> VOLUME </div>
    <?php the_field('volume'); ?>
    </div>
    
    <div class="col-xl-1 col-lg-3 col-md-3  col-sm-3 col-xs-3 journal-columns-gvs">
    <!-- part -->
    <div class="mobile-only-journal-title-gvs"> PART </div>
    <?php the_field('part_journal'); ?>
    </div>
    
    <div class="col-xl-1 col-lg-3 col-md-3  col-sm-3 col-xs-3 journal-columns-gvs">
    <!-- month -->
    <div class="mobile-only-journal-title-gvs"> MONTH </div>
    <?php the_field('month_journal'); ?>
    </div>
    
    <div class="col-xl-1  col-lg-4 col-md-4 col-sm-4 col-xs-4 journal-columns-gvs">
    <!-- year -->
    <div class="mobile-only-journal-title-gvs"> YEAR </div>
    <?php the_field('year_journal'); ?>
    </div>
    
    <div class="col-xl-2  col-lg-6 col-md-6 col-sm-6 col-xs-6 journal-columns-gvs">
    <!-- keywords/tags -->
    <div class="mobile-only-journal-title-gvs"> KEYWORD TAGS </div>
    
    <div class="desktop-only-journal-content-gvs">
    <?php $post_tags = get_the_tags();
    
    if ( $post_tags ) {
        foreach( $post_tags as $tag ) {
        echo $tag->name . ', ';
        }
    } ?>
    </div>
    
    </div>
    
    <!-- accordian end 2 -->
    </div>
    </div>
    </div>
    </div> <!-- close #accordion -->
    
    <!-- accordian end 2 -->
    
      <div class="col-xl-1 col-lg-3 col-md-3  col-sm-3 col-xs-3 journal-columns-gvs desk-only ">
      <!-- volume -->
      <div class="mobile-only-journal-title-gvs"> VOLUME </div>
      <?php the_field('volume'); ?>
      </div>
    
      <div class="col-xl-1 col-lg-3 col-md-3  col-sm-3 col-xs-3 journal-columns-gvs desk-only ">
      <!-- part -->
      <div class="mobile-only-journal-title-gvs"> PART </div>
      <?php the_field('part_journal'); ?>
      </div>
    
      <div class="col-xl-1 col-lg-3 col-md-3  col-sm-3 col-xs-3 journal-columns-gvs desk-only ">
      <!-- month -->
      <div class="mobile-only-journal-title-gvs"> MONTH </div>
      <?php the_field('month_journal'); ?>
      </div>
    
      <div class="col-xl-1  col-lg-4 col-md-4 col-sm-4 col-xs-4 journal-columns-gvs desk-only ">
      <!-- year -->
      <div class="mobile-only-journal-title-gvs"> YEAR </div>
      <?php the_field('year_journal'); ?>
      </div>
    
      <div class="col-xl-2  col-lg-6 col-md-6 col-sm-6 col-xs-6 journal-columns-gvs desk-only ">
      <!-- keywords/tags -->
      <div class="mobile-only-journal-title-gvs"> KEYWORD TAGS </div>
    
      <div class="desktop-only-journal-content-gvs">
      <?php $post_tags = get_the_tags();
    
      if ( $post_tags ) {
          foreach( $post_tags as $tag ) {
          echo $tag->name . ', ';
          }
      } ?>
      </div>
    
      </div>
    
    </div> <!-- close row -->
    
      <?php } // end while
    } // end if
    ?>
    
    <!-- accordion end -->
    
    </div> <!-- close container -->
    
    <?php get_footer(); ?>
    
    
    Anonymous
    #226223
    This reply has been marked as private.
    Trevor
    #226227
    This reply has been marked as private.
    Anonymous
    #226275

    OK. Thanks for the response.

    Trevor
    #226315

    Is there a reason why you are not using this Permalinks setting:

    https://www.screencast.com/t/vYY9u5fBHPcv

    (so-called Pretty Permalinks), so that the results page slug would then be entries

    You had not set the results template in the form, so I have added it for you here:

    https://www.screencast.com/t/YAQWOd1V

    Along with the entries slug. You then need a container to hold the results in (another outer div) so than Ajax can then work. Probably to wrap If have_posts …

    Maybe give that a class of search-results and use that the for Ajax Container (with a preceding period in the form setting of course)?

    Trevor
    #226317

    Oh, I changed the Permalinks to get that working.

    Anonymous
    #226323

    Thanks, Trevor, it’s working now. Have a good evening!

    Trevor
    #226326

    Thanks for letting me know. I will close this thread for now.

Viewing 10 posts - 1 through 10 (of 10 total)