In a recent task that I worked on, the requirement was to set up a custom field called "Related Services" for Posts and display this field's value in a sidebar widget. The widget should appear on the front-end i.e., on the single Post page only if the field has been populated for that particular Post.
In this article I share the tweaked code based on the example given in codex on creating a widget which displays the value of a custom field created using Advanced Custom Fields (ACF).
Custom field in the Post editor:
Widget in the sidebar:
On the single Post page:
Step 1
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
[…] from my earlier article titled How to create a custom widget that displays value of a custom field in WordPress, here I am going to share how I have set up a custom widget that pulls a fixed number of Custom […]