function get_post_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=<\'">(<^\'">+)<\'">.*>/i', $post->post_content, $matches); $first_img = $matches <1> <0>; if(empty($first_img)){ $img_dir = get_bloginfo('template_directory'); $first_img = $img_dir . '/images/thumb.gif'; } return $first_img;}
<img src="<?php echo get_post_image(); ?>" alt="<?php the_title(); ?>" width="130" height="130" />
<?php $a = 1; $query1 = new WP_Query();$query1->query('showposts=#&cat=*&orderby=desc'); ?><?php while ($query1->have_posts()) : $query1->the_post(); ?> <li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" target="_blank"><img src="<?php echo get_post_image(); ?>" alt="<?php the_title(); ?>" width="ความกว้างรูป" height="ความสูงรูป" /></a> <div><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></div></li> <?php endwhile; ?>
โปรดรอ
cymiz.com insurance