Skip to content

Instantly share code, notes, and snippets.

@chriswinch
Last active October 7, 2016 06:57
Show Gist options
  • Save chriswinch/4a820e09f3ae0b746ee04fae8a5e5ff9 to your computer and use it in GitHub Desktop.
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.
<?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