MWDelaney / sage-acf-wp-blocks

Composer library for generating ACF Gutenberg blocks from templates. Intended for use with Roots/Sage (http://roots.io)
346 stars 66 forks source link

ACF field not displaying #44

Closed fabianwurk closed 4 years ago

fabianwurk commented 4 years ago

I have a block with cpt query which works fine, it just isn't displaying the custom field - the image and the_content display fine. Is there something else that needs to be added to get acf text field displaying (testimonial_by')?

` $the_query = new WP_Query(array( 'post_type' => 'testimonial', 'posts_per_page' => -1, 'order' => 'DESC' ));

      ?>
      <?php if( $the_query->have_posts() ): ?>

        <?php while( $the_query->have_posts() ) : $the_query->the_post(); 

          ?>
          <div class="grid-x grid-margin-x">
            <div class="cell small-12">

              <div class="crest">
                <?php the_post_thumbnail( 'full' ); ?>
              </div>
              <p><?php the_content(); ?></p>
              <p class="name"><strong>
                Testimonial by: <?php the_field('testimonial_by'); ?>
              </strong></p>

            </div>
          </div>
        <?php endwhile; ?>

      <?php endif; ?>

      <?php wp_reset_query();   `?>````
fabianwurk commented 4 years ago

Issue has now been resolved.

mMoovs commented 7 months ago

@fabianwurk how did you resolve this? I think I might be having the same issue. Atleast it looks like the the_field() or get_the_field() isn't getting the correct item ID.

fabianwurk commented 7 months ago

@mMoovs sorry I can't remember where this repo was to check. But we have since changed to use this package for blocks in Sage 10: https://github.com/Log1x/acf-composer