• Ryan

    (@ryanjgillies)


    I’ve never fiddled with the code underlying a theme before, but I’m looking to make some small adjustments to the Boksy-Lite theme by including a custom field (in this case a translation of the title in Chinese). I’ve come up with the following code and popped it into content.php:

    <?php if ( get_post_meta(the_ID(), 'zh-title', true) ) : ?>
    <h3><?php echo get_post_meta(the_ID(), 'zh-title', true); ?></h3>
    <?php endif; ?>

    From what I gather this should pull the first value of zh-title (if it exists) and display it. Instead its displaying the post ID for every post, regardless of whether or not the custom field exists.

    Can anyone point out where I’m going wrong?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Displaying custom field in content.php’ is closed to new replies.