Support

Account

Home Forums Front-end Issues questions about get_field

Solved

questions about get_field

  • Hello friends!
    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.

  • Hi @udinei

    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.

    Thanks
    E

  • 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 [0]);

    A big hug to everyone

    Thank you!

  • Hi,

    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?

    thanks

    confused newbee :-/

  • Hi @rwilson86

    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?

    Thanks
    E

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

The topic ‘questions about get_field’ is closed to new replies.