Home Forums Front-end Issues Nothing showing up in the page! Reply To: Nothing showing up in the page!

  • Hi @theolddisabledguy

    The issue occurred because you tried to get the field outside The Loop. If you want to get it outside the loop, you need to provide the post ID. This page should give you more idea about it:

    Please try this code instead:

    <?php $loop = new WP_Query( array( 'post_type' => 'sponsor', 'orderby' => 'post_id', 'order' => 'ASC') ); ?>
    <div id="hero" class="sponsor-row clearfix">
        <?php while( $loop->have_posts() ) : $loop->the_post();
            $sponsor_image = get_field('sponsor_image');
            $sponsor_url = get_field('sponsor_url');
                <img src="<?php echo $sponsor_image["url"]; ?>" alt="<?php echo $sponsor_image["alt"]; ?>" />
                <a href="<?php echo $sponsor_url; ?>">LOLO</a>
                <?php var_dump( $sponsor_image ); ?>
        <?php endwhile; ?>
    <?php wp_reset_query();	 // Restore global post data stomped by the_post(). ?>

    I hope this helps.