This code enables you to efficiently output a specific list of custom field names and values conditionally. The custom field name and value are only printed if the value for each name exists.
The code uses the foreach loop function to display your custom field names with values rather than individual calls to each custom field so its more efficient.
Here’s the front end output without any CSS:
This example enables you to print a list of specific custom fields without printing all custom fields for each post. In this example the data is hooked after the content of each single post, if it exists. If empty, there is no output.
Here’s the code for logged in members:
Leave a Reply
You must be logged in to post a comment.