this is the section of archive.php dealing with thumbnail images:
<?php $thumb = tube_getcustomfield('wtp_thumb_url',get_the_ID()); if(!empty($thumb)) { ?>
<img src="<?php echo $thumb; ?>" alt="<?php the_title_attribute(); ?>" width="180" height="140" /> <?php } else { ?>
<img src="<?php bloginfo('template_url') ?>/images/pic_post1.jpg" width="180" height="140" alt="image" /><?php } ?>
do you want to integrate the ‘featured image’ into that conditional statement with top priority, or do you wnat to grab the first image from the post?
Just want the first or any image to be the thumbnail.
try to replace the earlier posted section with
(partly based on http://www.wprecipes.com/how-to-get-the-first-image-from-the-post-and-display-it ):
<?php //image section
$first_img = '';
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
if( $matches [1] ) $first_img = $matches [1] [0];
if(!empty($first_img)) { ?>
<img src="<?php echo $first_img; ?>" alt="<?php the_title_attribute(); ?>" width="180" height="140" />
<?php } else {
//$thumb = tube_getcustomfield('wtp_thumb_url',get_the_ID());
if( !empty( $thumb ) ) { ?>
<img src="<?php echo $thumb; ?>" alt="<?php the_title_attribute(); ?>" width="180" height="140" />
<?php } else { ?>
<img src="<?php bloginfo('template_url') ?>/images/pic_post1.jpg" width="180" height="140" alt="no post image" />
<?php }
} ?>
Alright I’m give me a sec.:)
Works like a charm. 😀
I added the same code to index file too and voila. Works on both places.
Btw one last thing. Is there any possible way I can change replace the Title of the post to Category name its posted in ?
change replace the Title of the post to Category name its posted in ?
the code for the post title is on that section (in archive.php from 132):
<div class="boxtitle">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php echo tube_get_limited_string($post->post_title,15); ?></a></h2>
</div>
to just show the name of (the first) category the post is posted in, try and change the section to:
<div class="boxtitle">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php
$post_cats = get_the_category();
$cat_name = $post_cats[0]->cat_name;
echo 'new '.$cat_name; ?></a></h2>
</div>
Worked again.
I right clicked on the images and saw this :
500px × 375px (scaled to 180px × 140px)
Is there a way I can generate the thumbnails to 149px × 111px.
I got it. Saw the earlier edit. Just need to change the dimensions. 🙂
Adding to all this You have been a really good help man. Thanks alot. I really mean it. btw do you know any simple way to make my wordpress mobile compatible ?