Forums Forums Search & Filter Pro Display ACF custom fields in search results

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #228131

    Hello –
    Do you know what I’m doing wrong here?
    I’m trying to display the two below ACF custom fields in my search results, but they don’t show up. What is the correct way to display them?

    Thanks!

    name: employer Type: Relationship
    name: salary Type: Text

    <?php the_field(’employer’); ?>
    <?php the_field(‘salary’); ?>

    —-

    <?php
    /**
     * Search & Filter Pro
     *
     * Sample Results Template
     *
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      https://searchandfilter.com
     * @copyright 2018 Search & Filter
     *
     * Note: these templates are not full page templates, rather
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode – think
     * of it as a template part
     *
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs
     * and using template tags –
     *
     * http://codex.wordpress.org/Template_Tags
     *
     */

    if ( $query->have_posts() )
    {
    ?>

    <h5 style=”#70757a”>Found <?php echo $query->found_posts; ?> Results<br /></h5>
    Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />

    <div class=”pagination”>

    <div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists(‘wp_pagenavi’))
    {
    echo “<br />”;
    wp_pagenavi( array( ‘query’ => $query ) );
    }
    ?>
    </div>

    <?php
    while ($query->have_posts())
    {
    $query->the_post();

    ?>
    <div class=”job-search-results”>
    <h2>“><?php the_title(); ?></h2>
    <?php
    if ( has_post_thumbnail() ) {
    echo ‘<p>’;
    the_post_thumbnail(“small”);
    echo ‘</p>’;
    }
    ?>        
                            <div class=”search-results-employer”><h5>Employer Name: <?php the_field(’employer’); ?> </h5></div>
                            <div class=”search-results-employer”><h5>Salary: <?php the_field(‘salary’); ?> </h5></div>
                            <div class=”search-results-location”><h5><?php the_terms( 0, ‘city’); ?>, <?php the_terms( 0, ‘job_country’); ?></h5></div>
                            <div class=”search-results-skills”><h5>Skills: <?php the_terms( 0, ‘job_expertise’); ?> </h5></div>
    <div class=”search-results-date”><h5><small><?php the_date(); ?></small></h5></div>
    </div>

    <hr />
    <?php
    }
    ?>
    Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />

    <div class=”pagination”>

    <div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists(‘wp_pagenavi’))
    {
    echo “<br />”;
    wp_pagenavi( array( ‘query’ => $query ) );
    }
    ?>
    </div>
    <?php
    }
    else
    {
    echo “No Results Found”;
    }
    ?>

    Trevor
    #228159
    This reply has been marked as private.
Viewing 2 posts - 1 through 2 (of 2 total)