Create a link to cite source using 3 custom fields
-
By no means am I an expert in php or coding really, so a complete dumbing down would be great.
I use Easy Custom Content Types (https://pippinsplugins.com/easy-content-types/) for my custom post types and custom meta boxes/custom fields.
My website is a baseball blog. I have created 3 fields to allow Authors to cite their main source in a news type of blog post:
Source title – The title of the article, blog post, etc
Source URL – The URL of the source
Source Name – Either the website name or person nameI want to display the source at the end of the article as:
Sample Source Title | Sample Source Name
The issue: All 3 fields are not always going to be present. For example, if the blog post refers to a radio or TV show, there will be no link, just the show name and the person name, or maybe even simple the person’s name.
I guess what I need is a conditional statement for all the combination possibilities?
echo get_post_meta($post->ID, 'ecpt_fieldname', true);
is used to call the custom field in the template.
Thanks for your help
- The topic ‘Create a link to cite source using 3 custom fields’ is closed to new replies.