Support

Account

Home Forums General Issues user to sort and filter ACF list Reply To: user to sort and filter ACF list

  • Hi James,

    Thanks for all the help. I am really new to all of this. I am kinda lost with everything.

    Here is the complete code for the results page that I have so far.

    <section class="col-sm-12 col-md-9 athlete main-content">
              <div class="athlete-name page-header">
                <h2 class="heading"><?php the_title();  ?></h2>
              </div><!-- /.athlete-name -->
    
                <?php if ( have_posts() ) : while ( have_posts() ) : the_post();  ?>
    
                <?php the_content();  ?>
    
                <?php endwhile; endif; ?>
    
    <hr>
                <?php
                  
                  //wp_reset_postdata();
                  $args = array(       
                    'post_type' => 'result',
                    'category_name' => 'results',
                    'orderby' => 'date',
                    'order'   => 'ACS',
                    'posts_per_page'  =>  15,
                    'paged'             =>  $paged
                    );
                  $the_query = new WP_Query( $args );       
                  //wp_reset_postdata();
    
                ?>
    
                <div class="col-md-12 index-results-Section">
    
                  <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
                  <div class="index-resultsSingle">
                         <div class="col-md-2 index-resultsAthlete">
                         <a href="<?php the_field('page_link'); ?>"><?php the_field( 'result-athlete' ); ?></a>
                      </div><!-- .index-resultsAthlete -->
    
                      <div class="col-md-7 index-resultsSport">
                       <?php the_field( 'result-sport' ); ?>
                         <?php the_field( 'result-date' ); ?>
                       </div> <!-- .index-resultsSport -->
    
                        <div class="col-md-3 index-resultsResult">
                          <?php the_field( 'result-result' ); ?>
                        </div> <!-- .index-resultsResult -->
    
                      <div class="clearfix"></div>
    
                   </div>
    
                  <?php endwhile; endif; ?>
    
    <div class="row"> <!-- Next and Previous -->
                      <?php if ($the_query->max_num_pages > 1) { // check if the max number of pages is greater than 1  ?>
                        <nav class="prev-next-posts">
                          <div class="col-md-4 prev-posts-link">
                            <?php echo next_posts_link( '< Older Results', $the_query->max_num_pages ); // display older posts link ?>
                          </div>
                          <div class="col-md-4 col-md-offset-4 next-posts-link">
                            <?php echo previous_posts_link( 'Newer Results >' ); // display newer posts link ?>
                          </div>
                        </nav>
                      <?php } ?>
                  </div>
                <div class="clearfix visible-sm"></div>
    
                </div>
            </section><!-- .athlete main-content -->

    Here is a link of something they would like it to be like.