Call First post image
From ThaiiS Note (Wiki)
using this function in the functions.php (wordpress themes folder)
<?php
function postimage($size=medium,$num=1,$lighbox=1) {
if ( $images = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => $num,
'order' => 'ASC',
'orderby' => 'ID',
'post_mime_type' => 'image',)))
{
foreach( $images as $image ) {
$attachmenturl=wp_get_attachment_url($image->ID);
$attachmentimage=wp_get_attachment_image($image->ID, $size );
$img_title = $image->post_title;
$img_desc = $image->post_excerpt;
if ($size != "full"){
echo '<a href="'.$attachmenturl.'" rel="lightbox" title="'.$img_desc.'">'.$attachmentimage.'</a>'.$img_title.'';
} else {
echo '<img src="'.$attachmenturl.'">';
}
}
} else {
echo "No Image";
}
}
?>
can use the function postimage() in your theme
<h1>Headline</h1>
<?php postimage('thumbnail'); ?>
Content ...
Example
<?php query_posts('category_name=Fm100;&showposts=4'); ?>
<?php while (have_posts()) : the_post(); ?>
<ul class="thumbnews">
<li class="thumbimg"><a href="<?php the_permalink(); ?>"><?php postimage('thumbnail'); ?></a></li>
<li class="thumbcon">
<div class="thumbtitle"><?php the_title(); ?></div>
<?php global $more; // Declare global $more (before the loop).
$more = 0; // Set (inside the loop) to display content above the more tag.
the_content("");
?>
