StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-05-2010, 12:13 PM
tutorials's Avatar
tutorials tutorials is offline
Training
 
Join Date: Aug 2009
Location: cyberspace
Posts: 825
Default How to Add Thumbnails to Your Blog Page and Category Archive Pages

Archive Page

Open archive.php and replace this:
Code:
<?php get_header(); ?>
with this:
Code:
<?php

get_header();

function sp_read_more_from($position) {
        ?>
                <strong><a href="<?php echo get_category_link(get_theme_mod($position)); ?>" rel="bookmark"><?php _e("Read More Posts From", 'studiopress'); echo " ". cat_id_to_name(get_theme_mod($position)); ?> &raquo;</a></strong>
        <?php
}

function sp_post_thumb($post, $position) {
        if( get_post_meta($post->ID, "thumb", true) ):
?>
        <a href="<?php the_permalink() ?>" rel="bookmark">
                <img class="thumb" src="<?php bloginfo('template_directory'); ?>/tools/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&amp;h=<?php echo get_theme_mod($position.'_thumb_height'); ?>&amp;w=<?php echo get_theme_mod($position.'_thumb_width'); ?>&amp;zc=1" alt="<?php the_title(); ?>" />
        </a>
<?php
        else:
                // You might want to show a default image?
        endif;
}
?>
Then add this:
Code:
   <?php sp_post_thumb($post, 'featured_main'); ?>
immediately above this:
Code:
  <?php the_excerpt(); ?>
This will place a thumbnail image the same size as the image chosen in Featured Main in your theme options panel.

Blog Page

Open page_blog.php and replace this:
Code:
<?php get_header(); ?>
with this:
Code:
<?php

get_header();

function sp_read_more_from($position) {
        ?>
                <strong><a href="<?php echo get_category_link(get_theme_mod($position)); ?>" rel="bookmark"><?php _e("Read More Posts From", 'studiopress'); echo " ". cat_id_to_name(get_theme_mod($position)); ?> &raquo;</a></strong>
        <?php
}

function sp_post_thumb($post, $position) {
        if( get_post_meta($post->ID, "thumb", true) ):
?>
        <a href="<?php the_permalink() ?>" rel="bookmark">
                <img class="thumb" src="<?php bloginfo('template_directory'); ?>/tools/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&amp;h=<?php echo get_theme_mod($position.'_thumb_height'); ?>&amp;w=<?php echo get_theme_mod($position.'_thumb_width'); ?>&amp;zc=1" alt="<?php the_title(); ?>" />
        </a>
<?php
        else:
                // You might want to show a default image?
        endif;
}
?>
Then add this:
Code:
   <?php sp_post_thumb($post, 'featured_main'); ?>
immediately above this:
Code:
  <?php the_excerpt(); ?>
This will place a thumbnail image the same size as the image chosen in Featured Main in your theme options panel.

Last edited by CharlesClarkson; 01-09-2010 at 09:16 AM. Reason: the_excerpt() doesn't take arguments.
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with "How to Add Thumbnails to Your Blog Page and Category Archive Pages" RSchulte General Discussion 2 01-23-2010 09:36 AM
Pb with tutorial "Add Thumbnails to Your Blog Page and Category Archive Pages" shuyvenaar General Discussion 2 01-09-2010 11:55 AM
How to Add Thumbnails to the Blog Page and Category Archive Pages tutorials General Discussion 1 01-05-2010 12:45 PM
How to Add Thumbnails to Your Blog Page and Category Archive Pages tutorials General Discussion 1 01-05-2010 12:02 PM
How to Add Thumbnails to Your Blog Page and Category Archive Pages tutorials General Discussion 1 01-05-2010 12:01 PM


All times are GMT -5. The time now is 03:15 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.