Make WordPress post thumbnail while
















1)____________

<ul class="bjqs">

<?php query_posts('showposts=4 & cat=1,2,3'); if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

<li><?php

if ( has_post_thumbnail($thumbnail->ID)) {

echo '<a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';

echo get_the_post_thumbnail($thumbnail->ID, 'thumbnail');

 echo '</a>';

}

?>

</li>



2)__________


<?php
$content = '<ul">';
$loop = new WP_Query( array( 'post_type' => 'your_post_type', 'posts_per_page' => 10, 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC' ) );
while ( $loop->have_posts() ) : $loop->the_post();
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'full', true);
$content .= '<li><a href="';
$content .= get_permalink();
$content .= '"><img src="';
$content .= $thumb_url[0];
$content .= '" alt="';
$content .= get_the_title();
$content .= '" /></a></li>';
endwhile;
$content .= '</ul>';
echo $content;

?>



3)___________


<ul>
<?php query_posts('showposts=10 & cat=2'); if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<li><?php
if ( has_post_thumbnail($thumbnail->ID)) {
echo '<a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';
echo get_the_post_thumbnail($thumbnail->ID, 'thumbnail');
 echo '</a>';
}
?>
</li>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>

</ul>




Comments

Popular posts from this blog

Text Smooth Scrolling Marquee use jQuery