Please bear with me because I am new to this. So I have a custom field that I created using Advanced Custom fields in Wordpress.
The name of my template code is template-test.php and contains the following
<div class="item-one"><?php the_content(); ?><span>text1</span></div>
<div class="item-two"><?php echo get_field('sponsor_advertisement_one'); ?><span>text2</span></div>
<div class="item-three"><?php echo get_field('sponsor_advertisement_two'); ?><span>text3</span></div>
Now, when I use Wordpress admin to preview page template-test.php by clicking the update button and clicking preview. I can see my posts (the contents of 'sponsor_advertisement_one' and 'sponsor_advertisement_two')
But when I try to include the same template file into another page (home.php) using:
<?php include("template-test.php"); ?>
only the text within the span shows up.
Note: both php pages (template-test.php and home.php are in the same directory.
I've been banging my head against the wall on this.
get_template_part('template','test');instead of include. I think you are using ACF plugin make sure you put the post ID. It is missing the specific post ID where your value was entered. - Maqk