WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Simple Tags] Including images in Related Posts (1 post)

  1. AdamGunderson
    Member
    Posted 5 years ago #

    Has anyone been able to include images next to the links of the Related Posts?

    I am close, this is what I am working with:

    function rppostimage($size=thumbnail) {
    if ( $images = get_children(array(
    'post_parent' => get_the_ID(),
    'post_type' => 'attachment',
    'numberposts' => 1,
    'post_mime_type' => 'image',)))
    {
    foreach( $images as $image ) {
    $attachmenturl=wp_get_attachment_url($image->ID);
    $attachmentimage=wp_get_attachment_image( $image->ID, array(98,98));
    
    echo $attachmentimage;
    }
    } else {
    echo "No Image";
    }
    }

    I put this in the Post Link format:
    <a href="%post_permalink%" title="%post_title% (%post_date%)">%post_title%</a><BR /><?php rppostimage('thumbnail'); ?>

    and nothing happens! Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic