Home Forums General Issues Value not loading on Posts page


Value not loading on Posts page

  • I used the guide I found on this page to write this code:

    <?php if(the_field('publication', get_option('page_for_posts')))
    		 echo ' / '.the_field('publication', get_option('page_for_posts'));

    It works, in that it pulls the publication name to the Blog page. What does not work, no matter how I try it, is getting any text before the Publication name. As you can see in my code, I am attempting to put a ” / ” before the publication name. The slash is not showing. Nor is anything I try and echo. Am I doing the If statement wrong?

  • You need to use get_field. the_field echos the content of the field

    <?php if(get_field('publication', get_option('page_for_posts')))
    		 echo ' / '.get_field('publication', get_option('page_for_posts'));
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Value not loading on Posts page’ is closed to new replies.