Support

Account

Home Forums General Issues Getting custom field to show in sidebar

Solved

Getting custom field to show in sidebar

  • 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)

The topic ‘Getting custom field to show in sidebar’ is closed to new replies.