Please if someone could help ill be very greatful.
I know how to use the if statement using Advanced Custom Fields on posts - but this time I want to pull the value from the Advanced Custom Fields in the category, I have managed to put this code together - but can't work out how to make it an if statement.
This code pulls the value from the category custom field - how can i convert it to if value empty do "X" if true do "Z"
<?php
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
the_field( 'logo_src', $taxonomy . '_' . $term_id );
?>
My failed attempt:
<?php
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
if ( get_field('logo_src', 'true', $taxonomy . '_' . $term_id ) ) {
?>
do x
<?php } else { ?>
do z
<?php } ?>
Thanks in advance!
the_field
echoes, you have to useget_field
. – Milo Mar 24 '16 at 20:05