Last active
October 7, 2016 06:57
-
-
Save chriswinch/4a820e09f3ae0b746ee04fae8a5e5ff9 to your computer and use it in GitHub Desktop.
ACF - Combine the_field & the_sub_field into one function for better modularity.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function the_acf_field($acf) { | |
$field = get_field($acf); | |
if(!$field) { | |
$field = get_sub_field($acf); | |
} | |
echo $field; | |
} | |
function get_acf_field($acf) { | |
$field = get_field($acf); | |
if(!$field) { | |
$field = get_sub_field($acf); | |
} | |
return $field; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment