WordPress.org

Forums

Custom fields in WP 3.0 (3 posts)

  1. darrent71
    Member
    Posted 5 years ago #

    I installed the WP Featured Content Slider plugin which almost works perfectly in WP 3.0.

    My problem is it displays the post title and contents but not the custom field which is for a thumbnail image.

    The php code is as follows:

    <?php $gallery = get_post_meta($post->ID, 'Thumbnail', $single = true); ?>
    <img src="<?php echo $gallery; ?>" alt="" />

    Is there something different in WP 3.0 which is preventing this from working? Do I need to change syntax? Any help would be great thanks!

  2. Austin Matzko
    Member
    Posted 5 years ago #

    If you change $post->ID to get_the_ID() does that make a difference? Like so:

    <?php $gallery = get_post_meta(get_the_ID(), 'Thumbnail', $single = true); ?>
    <img src="<?php echo $gallery; ?>" alt="" />
  3. darrent71
    Member
    Posted 5 years ago #

    Brilliant thanks, thats fixed it!

Topic Closed

This topic has been closed to new replies.

About this Topic