Support

Account

Home Forums Front-end Issues Nothing displays on Front-End

Helping

Nothing displays on Front-End

  • Hi, I know this has been asked and I can’t figure out what is keeping the fields from displaying. The field shows as it should in the admin area and the data is there. Below is a basic custom page template:

    <?php 
    /*
    Template Name: Event Page Template
    */
    get_header();
    if ( have_posts() ) : while ( have_posts() ) :the_post();
    $snippet = get_field( "snippet" );
    ?>
    
    <div class="container pad130">
    
    		<p><?php the_field( $snippet ); ?></p>
    		<?php the_content(); ?>
    	
    
    </div><!-- #content -->
    
    <?php endwhile; endif; get_footer(); ?>

    Any help to where to look would be appreciated. Thnx

  • Hi @walkingfish

    First, can you confirm that this template file is the correct one for the URL you are viewing?

    You can test by simply adding this to the file:
    <h1>Hello World</h1>

    Secondly, your code contains an incorrect syntax for the the_field function. Please read over the docs for both functions used to see that they both accept a string parameter of the field_name, not a value.
    <p><?php the_field( $snippet ); ?></p> should be <p><?php the_field( "snippet" ); ?></p>

    Thanks
    E

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

The topic ‘Nothing displays on Front-End’ is closed to new replies.