nlck1
Member
Posted 10 months ago #
Hello,
I have problems with the fields showing up on the posts. I'm not really good with php. What I have been doing is putting this into the bottom of functions.php (theme functions.php)
function getCustomField($theField) {
global $post;
$block = get_post_meta($post->ID, $theField);
if($block){
foreach(($block) as $blocks) {
echo $blocks;
}
}
}
And this into single.php
<?php getCustomField('Day Number'); ?>
This is my settings.
[Day Number]
type = text
size = 10
output = true
I'm using Suffusion theme and I have no idea what I'm doing wrong.
Thanks in advance
http://wordpress.org/extend/plugins/custom-field-template/
nlck1
Member
Posted 10 months ago #
Update:
Found that I should only need to add
<?php echo get_post_meta($post->ID, 'Your Field Name', true); ?>
to the template but I have no idea which file or line.
Thanks.
Tara Rotten
Member
Posted 9 months ago #
Hey
Do you know how to add the custom field name as well as the field content
e.g:
Day Number: field content
??
Yes, this takes a little getting your head round.
Nick1. Your code goes into the page (ie: page.php or single.php) in the position you want it to show.
I'm trying to get these custom fields to show in a widget - anyone know how to do that?