WordPress.org

Ready to get started?Download WordPress

Forums

How to display data from custom field in search results (2 posts)

  1. inglaur
    Member
    Posted 3 years ago #

    Trying to display a "featured" or "special" graphic beside post title displayed in results using custom fields in posts. (only to be shown in results - didn't like custom html in post title) Current code is

    <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>

    Anyone like to help me - i've only started using wordpress about a month!

  2. inglaur
    Member
    Posted 3 years ago #

    Did it myself

    Add new custom field "Featured", enter url of image

    This goes into search.php within the while loop

    <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><img src="<?php echo get_post_meta($post->ID, "Featured", true);?>" /></h3>

Topic Closed

This topic has been closed to new replies.

About this Topic