Support

Account

Home Forums Front-end Issues Custom Fields Data Not Displaying on Frontend

Solved

Custom Fields Data Not Displaying on Frontend

  • Hi!

    I have already look around plugin documentation and almost tried everything to display values data in my WordPress theme’s font-end, unfortunately I was failed.

    I have also tried all steps in mentioned on https://www.advancedcustomfields.com/resources/displaying-custom-field-values-in-your-theme/

    I have created 2 custom fields having field names – title_long_description and long_description

    And, to render these field’s data on my website page, I have tried all examples shown at https://www.advancedcustomfields.com/resources/code-examples/ but nothing get useful in returns.

    I’ve attached the php template file.

    Can anyone explain what is the problem with the coding? or Kindly provide me some best solution.

    Any help is always appreciated.

    Thanks
    Lalit

  • Hi @lalitme,

    Thanks for the post.

    It looks like you are calling the custom fields outside the main posts loop and thus ACF is not able to reference the value of the current post.

    You will need to assign a post id string as the second parameter to the_field() function like so:

    <?php the_field('title_long_description', $post_id); ?>

  • Thnaks Mr James for the reply.

    No I’m not calling the custom fields outside the main post loop.

    However still I have tried your solution but it didn’t work.

  • Hey all,

    Well, I am not very technically strong in php coding.

    While keep facing the problem in displaying fields data on frontend, I got tired and installed “Pods – Custom Content Types and Fields by Pods Framework Team” this plugin is also great. But I again moved on ACF documentation and found a solution from Get values from a taxonomy term.
    https://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/

    The above threat helped me.

    Thank James.

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

The topic ‘Custom Fields Data Not Displaying on Frontend’ is closed to new replies.