Hi
I have added a conditional field (secondary_content) that only appears on the ‘Who we are’ page (not post), I am attempting to echo the field into the page.php template but I keep getting the error:
Fatal error: Call to undefined function the_secondary_content() in /home/zerodot9/public_html/preview/star/wp-content/themes/bonanza/page-team-grid.php on line 82
1. Do I need to add a function to the functions.php?
2. How would I then echo the custom field, I have been trying to use this in the loop:
echo the_field('secondary_content');
I have searched the forum but couldn’t dig out an answer, thank you for any assistance!
Hi!
1. No, you dont have to add anything to functions.php
2. you cannot use the_secondary_content() unless that’s a function you’ve created yourself..
In order to output the value of the field you can use either:
echo get_field('secondary_content');
//or
the_field('secondary_content');
and this should work if you put it inside your loop as long as it’s a standard loop and not just a foreach or something.
Are you certain that the “who we are” page uses page.php and not a custom template?