WordPress.org

Ready to get started?Download WordPress

Forums

Rusty php query (2 posts)

  1. formica
    Member
    Posted 4 years ago #

    Hello

    I have a simple 'ish' php query, I'm attempting to list posts from a single category and to include the thumbnails i've assigned to each.

    I'm using p75GetThumbnail from 'simple post thumbnails'. As you can see i'm echoing the 'thumbs' path in the img src and it's working fine but only returning the img of the current pages thumbnail not listing the thumbs from each post.

    Can anyone help please?

    <?php
    $thumbs = p75GetThumbnail($post->ID, 110, 110);
    ?>
    
    <?php
    $result = "<ul class='lcp_catlist'>";
    $catposts = get_posts('this_months_news='.$ID."&numberposts=".$NUMBEROFPOSTS);
    foreach($catposts as $single):
    	$result .= "<li><a href='";
    	$result .=get_permalink($single->ID)."'>".$single->post_title."<img src='$thumbs;' /></a></li>";
    endforeach;
    $result .= "</ul>";
    echo $result;
       ?>
  2. formica
    Member
    Posted 4 years ago #

    Cor blimey! just solved my own problem. Wonders will never cease.

    Thanks anyway guys:

    <?php
    $result = "<ul class='lcp_catlist'>";
    $catposts = get_posts('this_months_news='.$ID."&numberposts=".$NUMBEROFPOSTS);
    foreach($catposts as $single):
    	$result .= "<li><a href='";
    	$result .=get_permalink($single->ID)."'>".$single->post_title."'<img src='".p75GetThumbnail($single->ID, 110, 110)."' /></a></li>";
    endforeach;
    $result .= "</ul>";
    echo $result;
       ?>

Topic Closed

This topic has been closed to new replies.

About this Topic