Support

Account

Home Forums General Issues Getting custom field to show in sidebar

Solved

Getting custom field to show in sidebar

    • aliwest

    • July 23, 2013 at 10:03 pm

    I’m having problems getting a custom field called ‘link’ to show up in the sidebar of a page. The custom field is added in a custom post and is shown up in the sidebar of various pages. Not sure what I’m doing wrong as have tried various combinations of get_field but can’t seem to get it to show up.

    I then thought it was probably because it needs to get the field from the particular post which has an id 510 but I can’t seem to figure out the code needed to get it to show up in the sidebar.

    Hope that’s explained correctly; any help much appreciated!

  • @aliwest

    If you want the field value from just 1 post, you could enter 510 as the second argument like:

     $field = get_field('link', 510);
    echo $field; 
    // etc...
    

    This should work regardless of where the code is placed.

  • thank you that works a treat!

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.