right now i have two custom values, one for Author information and one for a Surtitle. The author part is working fine, and is showing up on the page with this code:
<?php
$custom = get_post_custom_values('Author');
if (count($custom) != 0)
{
// do your thing
echo $custom[0];
// maybe do more things
} ?>
but I can't get it to display another custom value, even though I think I'm changing all the right variables. could anyone give me some help in displaying 2 different custom values on one page?
Are you trying to echo more things in the $custom array?
If so:
echo $custom[0];
echo $custom[1];
// etc
Also, are you sure it's a numbered array, and not an associative array? I.e.:
echo $custom['Author'];
echo $custom['Other_detail'];
// etc
i'm trying to echo the value of a custom field called "surtitle"
Try either $custom[1] or $custom['surtitle'].
i tried those, and neither one works
Also have you checked out this:
http://codex.wordpress.org/Using_Custom_Fields
Try:
echo get_post_custom_values('Author');
echo get_post_custom_values('surtitle');
that's not working either.
now it's displaying something at least, but it's just displaying the word "Array"
WillHines
Member
Posted 5 years ago #
Maybe underneath
// maybe do more things
try
print_r($custom)
to see what's getting put in there.