How show the_field() function’s content ACF via get_template_part()
-
Hi guys I would like to put several pages content in my index.php, so I use page-{slag} calling specific page trough get_template_part(). But the thing is that in my specific pages I used the_field() from Advance Custom Filed plugin. And content I dont see. I see that browser rendered div-s and so but content of the_field disappears. How I can solve this ?
the code of index.php<?php if ( have_posts() ) : the_post();?> <div> <?php get_template_part( 'page', 'shop' ); ?></div> <?php endif; ?>
And code of page-shop.php
<div class="container-fluid "> <!-- play section --> <div class="row"> <div class="col-xs-12 col-sm-2 col-md-2 col-lg-2"> <h2 class="" style="text-transform:uppercase"><?php the_field('shop_name');?></h2> </div> <div class="col-xs-12 col-sm-2 col-md-2 col-lg-2"> <h2 class="" style="text-transform:uppercase"><?php the_field('shop_category');?></h2> </div> <div class="col-xs-10 col-sm-10 col-md-7 col-lg-7 "> <?php $image = get_field('shop_item1'); if( !empty($image) ): ?> <img class=" img-responsive" src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> <?php endif;?> </div> </div> <!-- row --> </div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How show the_field() function’s content ACF via get_template_part()’ is closed to new replies.