Support

Account

Home Forums General Issues Field data not appearing in page

Solved

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

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

The topic ‘Field data not appearing in page’ is closed to new replies.