Support

Account

Home Forums General Issues General Question regarding displaying code

Helping

General Question regarding displaying code

  • Hey,

    this is maybe stupid question but I am having a real struggle here. I have this loop:

    <?php
    $query = new WP_Query('posts_per_page=1&orderby=rand');
    if ($query->have_posts()): while ($query->have_posts()): $query->the_post();
    // get the id for our current post and store it in a variable
    $hero_post = get_the_ID();
    get_template_part('template-parts/home-hero');
    endwhile; endif;
    get_template_part('template-parts/home-spectrum');
    ?>

    and this in my home-hero.php:

    <p class="mv0 mw6 f5 white roboto-light lh-copy">
    <?php the_field('test'); ?>
    
    

    and

    <p class="f6 mv0 roboto-medium white link">
    <?php the_title(); ?>
    
    <p class="f6 mv0 roboto-light-i white link">
    <?php the_field('subhead'); ?>
    
    

    the lower part with the_title() and the_field('subhead') is displayed but the the_field('test') wont show up.

    I set up the the_field(subhead) for posts and the_field for pages and template pages.

    Can you help me please?

  • ok i found the problem 🙂

    I forgot to use the Post=>ID for the the_field('test').

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

The topic ‘General Question regarding displaying code’ is closed to new replies.