I’m trying to get the value of a Field Type text with the code in functions.php
$ _value = get_field (“field_52a540ce878ab”);
$ _value = the_field (“field_52a540ce878ab”);
But it always returned the value of the Default Value field. Did you get entered in the text field editor value. I’m not using subpage.
Anyone know why this not returning the value or how to do this?.
I thank you.
I have moved this question to a new topic, because it was not related to the previous thread.
In your question, you mentioned that you are using the above code in your functions.php file.
If so, you will need to specify a post_id as a second parameter to tell AF from with post to load the data from.
Please read over the docs regarding get_field to learn more about the post_id parameter.
Hope that helps.
elliot. Thanks indeed lacked id_post the same post.
Unable to get the id of the functions.php post using the function
$ postid = get_the_ID ();
I used the form below and it worked:
$ url = explode (‘?’., ‘http://’ $ _SERVER [“HTTP_HOST”] $ _SERVER [“REQUEST_URI”].);
$ Id = url_to_postid ($ url );
A big hug to everyone
I use ” alt=”reason 1″ /> to upload image and load the image at the admin part, but have no result at the alive page – please see http://blog.goalify.com/features/ (‘Simple goals setting’).
But if I use ” alt=”reason 1″ />
It works for me, but why am I not able to work with images according to docs (” alt=”” />)?
Thank you in advance
hi i am also confused as get_field wont show on my product page. I have added custom field in my admin and its called protein, i have add the value for this field in the admin & now trying to get it to show on my product page. I have inserted this code <?php echo $Protein;?> into my product page but I cant see the field on my product page?
confused newbee :-/
I am unsure what data you have stored in the variable
$Protein;, but ACF requires you to use a function called get_field or the_field to display data.
There are loads of documentation resources on this website, perhaps you could read over the docs?
You must be logged in to reply to this topic.
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!
© 2019 Advanced Custom Fields. Subscribe