Last active
January 30, 2023 06:31
-
-
Save nicmare/3564411aef5353c2d6f3f96c27d1a86b to your computer and use it in GitHub Desktop.
simple function to place acf field values where ever needed in content
This file contains hidden or 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 acf_get_field_shortcode($args = array()){ | |
if(!function_exists("get_field")) return ""; | |
$field = (isset($args["field"]) && !empty($args["field"]))?get_field($args["field"]):false; | |
if($field) return $field; | |
return ""; | |
} | |
add_shortcode("acf_get_field","acf_get_field_shortcode"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment