-
-
Save timothyjensen/b20040fd28130672c734527338081286 to your computer and use it in GitHub Desktop.
ACF get json by name.
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 | |
/** | |
* Returns the ACF JSON filename by group name. | |
* | |
* @param string $field_group_name Name of the ACF field group | |
* @return string|bool | |
*/ | |
function get_acf_json_by_name( string $field_group_name ) { | |
$field_group_lookup = [ | |
'hero' => 'group_59e226a200966.json', | |
'cta' => 'group_59e226a200967.json', | |
// Add more field_group_name => file_name pairs here. | |
]; | |
if ( ! isset( $field_group_lookup[ $field_group_name ] ) ) { | |
return false; | |
} | |
return $field_group_lookup[ $field_group_name ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment