Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. /**
  2. * Simple boolean helper to check if ACF is on.
  3. * @return boolean
  4. */
  5. function is_acf(){
  6. return function_exists( 'get_field' ) ? true : false;
  7. }
  8.  
  9. /**
  10. * Helper function for ACF get_field function
  11. * @param string $field Field name
  12. * @param integer $post_id Optionally pass the post ID
  13. * @return varies Returns contents of get_field
  14. */
  15. function gf( $field, $post_id = null ) {
  16. if ( ! is_acf() ) {
  17. return false;
  18. }
  19. if ( get_field( $field, $post_id ) ) {
  20. return get_field( $field, $post_id );
  21. } else {
  22. return false;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement