How to add custom-field in wordpress function.php file?
-
Hi, in my wordpress theme in functions.php file I have function like below:
$posttitle = get_the_title($post->ID); // Display post title. $html .= '<div class="table">' . '<div class="name">'.$posttitle.'.</div>' . '</div>';I create custom-filed in my wordpress post as cfield = one.
I tried to use this function to display of ‘cfield’ value but it doesn’t work:
global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'cfield', true); wp_reset_query();How to add my ‘cfield’ custom-field to this function below where “HERE” is:
$html .= '<div class="table">' . '<div class="name">HERE '.$posttitle.'.</div>' . '</div>';
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘How to add custom-field in wordpress function.php file?’ is closed to new replies.