Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Simple boolean helper to check if ACF is on.
- * @return boolean
- */
- function is_acf(){
- return function_exists( 'get_field' ) ? true : false;
- }
- /**
- * Helper function for ACF get_field function
- * @param string $field Field name
- * @param integer $post_id Optionally pass the post ID
- * @return varies Returns contents of get_field
- */
- function gf( $field, $post_id = null ) {
- if ( ! is_acf() ) {
- return false;
- }
- if ( get_field( $field, $post_id ) ) {
- return get_field( $field, $post_id );
- } else {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement