WordPress.org

Support

Support » How-To and Troubleshooting » Rusty php query

Rusty php query

  • 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;
       ?>
Viewing 1 replies (of 1 total)
  • 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;
       ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Rusty php query’ is closed to new replies.
Skip to toolbar