Answers for "get custom field"

PHP
1

get custom field

/* put this code in home.php file create in child theme  */

<?php 
 /*Template Name: Home Template*/
 
echo get_post_meta($post->ID, 'Name', true); 
  
?>
 /* Or use this code  */
 <?php 
	$value =get_field('Name');
	echo $value;
?>
Posted by: Guest on October-23-2020
2

acf get field

$value = get_field( "text_field" );

if( $value ) {
    echo $value;
} else {
    echo 'empty';
}
Posted by: Guest on June-29-2020
0

how to get all post fields in wordpress

echo '<pre>';
print_r(get_post_custom($post_id));
echo '</pre>';
Posted by: Guest on April-27-2020

Browse Popular Code Answers by Language