0

I'm having a problem where after I have ran a while loop to get my thumbnail images my advanced custom fields that run after the loop don't display.

I'm assuming the fix is similar to here Stackoverflow question However I cant for the life of me work it out.

Here's the section with the loop. I'm using it inside a div so I can change the background of the div.

Anyone know the problem?

gist here

    <section id="portfolio">
        <h3>Projects</h3>
        <div class="card-container">

            <?php global $query_string;
            query_posts ('posts_per_page=3');
            while(have_posts()) : the_post(); ?>

                <div class="outer">
                    <div class="target">
                        <div class="card">
                            <div class="front">

                                <div class="thumbnail" <?php
                                if ( $id = get_post_thumbnail_id() ) {
                                    if ( $src = wp_get_attachment_url( $id ) )
                                    printf( ' style="background-image: url(%s);"', $src );
                                }
                                ?>>
                                </div>

                                <h5><?php the_title(); ?></h5><?php the_excerpt('Read More'); ?>
                                <a href="#" class="btn  btn-front hide-desk">View Site</a>
                            </div>

                            <div class="back">
                                <h5><?php the_title(); ?></h5>
                                <hr>
                                <p class="return"><?php the_content() ?></p>
                                <a href="#" class="btn btn-small">View Site</a>
                            </div>
                        </div>
                    </div>
                </div>
            <?php endwhile; ?>


            <a href="#" class="btn">View More</a>

        </div>
    </section>
Middi
  • 343
  • 1
  • 3
  • 12
  • Did you try ``after the while loop? – jh1711 Aug 14 '17 at 19:05
  • @jh1711 just tried it. i also tried When i remove the loop it all works as it should. I think it's definitely something to do with reseting posts in some way. I'm just not knowledgable enough to figure it out. – Middi Aug 14 '17 at 20:15

0 Answers0