Home › Forums › General Issues › Field data not appearing in page
Hi
something is not working when trying to display data from a simple text field
i created a field named uni-title
and used this in my template
<h3><?php the_field('uni_title'); ?></h3>
all I get is an empty h3 tag
the page is in hebrew and here is the page link
I used it in the right sidebar under the short form
Thanks
Well I t does work in the default page template
the one I am having problem with is a portfolio template
maybe that’s what causing it
will appreciate any suggestions
Thanks
hi!
Is it uni-title or uni_title? Make sure those match since you’ve written both in your description..
It should not matter what template you’re using it on, but I guess that depending on where in the template you use it you might need to provide the post id as well.. try this:
<?php global $post; ?>
<h3><?php the_field('uni_title', $post->ID); ?></h3>
hi Jonathan
Thanks for the quick response!
I tried your solution but it still doesnt work.
I put the code in the sidebar section of the template
you can see the page code here:
https://www.dropbox.com/s/2hw4f6g1guvotfh/page-portfolio-col3-sidebar.php
Thanks again
Ronen
Ah! We’ll it seems your wp_query that comes after the regular loop overwrites the post object with this: $wp_query->the_post();
You can try putting wp_reset_postdata(); right after the endwhile for that loop.. If that does not work try putting the value in a variable inside the regular loop that comes before the new wp_query and then access the variable where you need it 🙂
Great!
the second solution worked
I learned something too
thank you so much
The topic ‘Field data not appearing in page’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.