Reputation: 5
I want to show a symbol as a separator between two meta fields but only when both are present — often only one will be in use, in which case I don't want to show the separator.
This is what I have at the moment:
<?php if ( get_post_meta($related->ID, 'author', true && $related->ID, 'photographer', true)) : ?>
I think the problem lies in the brackets but I've tried a ton of variations and can't get it to work. Can anyone point me in the right direction?
Upvotes: 0
Views: 130
Reputation: 7715
You need to call the function twice to make this kind of comparison. The only thing that can be passed with a function are arguments.
<?php if ( get_post_meta($related->ID, 'author', true) && get_post_meta($related->ID, 'photographer', true)) : ?>
Upvotes: 1