$content = get_field('content', $post_id);
<?php echo get_field( "text_field" );?>
get_field($selector, [$post_id], [$format_value]);
/*
$selector (string) (Required) The field name or field key.
$post_id (mixed) (Optional) The post ID where the value is saved. Defaults to the current post.
$format_value (bool) (Optional) Whether to apply formatting logic. Defaults to true.
*/
// Get a value from the current post
$value = get_field( "text_field" );
// Get a value from a specific post
$value = get_field( "field_name", $post_id );
$value = get_field( "text_field" );
if( $value ) {
echo $value;
} else {
echo 'empty';
}
get_field_object('content', post_id);
<?php $text_field = get_field( "text_field" ); ?>
<h2><?php echo $text_field; ?></h2>
$post_id = false; // current post
$post_id = 123; // post ID = 123
$post_id = "user_123"; // user ID = 123
$post_id = "term_123"; // term ID = 123
$post_id = "category_123"; // same as above
$post_id = "option"; // options page
$post_id = "options"; // same as above
the_field( 'my_field', $post_id );