Custom fields are a somewhat more advanced WordPress feature that lets you add extra information to specific posts. That information is called ‘metadata’. Custom fields and metadata are of particular use to developers, who can use them to extend posts with all sorts of additional coding.
Add Custom Fields to Your WordPress Posts
1: Enable Custom Fields and Assign New Metadata to Your Post
Click on the three dots in the top right corner and select Preferences from the dropdown list:
Then, select Panels from the popup menu and enable Custom fields. You’ll now be prompted to Enable & Reload:
Now, if you scroll down below the post, you’ll find a new section:
2: Add Conditional Code to Your Theme File
Within WordPress, you’ll want to navigate to Tools > Theme File Editor. Here, you can look through and make changes to the files that make up your site. You’ll want to check out the sidebar on the right-hand side and find the Single Post file (also known as single.php):
$meta = get_post_meta( get_the_ID(), 'Sponsored Post' ); if( $meta[0] == 'Yes' ) { This post is sponsored content, and we received a free copy of the product in order to conduct our review. }