ThemeShaper Forums » Thematic

[closed]

How to add thumbnails to category pages?

(14 posts)
  • Started 9 years ago by wownflutter
  • Latest reply from dorabelle
  • This topic is not resolved
  1. wownflutter
    Member

    When I am on a category, the page just is a long list of headlines and text.

    Can I put a thumbnail next to each of these listings.

    (I am a web designer who has a majority of his portfolio in the blog)

    Thanks!

    wnf

    Posted 9 years ago #
  2. Hobrecht
    Member

    Hi wownflutter.
    Sorry but I can't help you. I have the same problem.

    Neither
    http://justintadlock.com/archives/2009/11/16/everything-you-need-to-know-about-wordpress-2-9s-post-image-feature?utm_source=faqpal.com
    nor
    http://a.parsons.edu/~zeravivm/f09/osd/12/14/wordpress-2-9-thumbnail-option-code-and-links-for/
    helped me out off this misery.

    I only understood that I have to copy " add_theme_support( ‘post-thumbnails’ ); " to the functions.php but the rest didn't work or I put it at the wrong place in the wrong phps.

    So were do I have to put what and do I have to create a new php?
    I'm using a thematic child and WP 2.9.1

    Thanks for help.

    Posted 9 years ago #
  3. Hi,

    that's an easy one if you know the second function ;)

    This code will add the thumbnail in front of the post title:

    add_theme_support( 'post-thumbnails' );
    
    function my_post_title($title) {
    	return get_the_post_thumbnail(NULL, 'thumbnail') . $title;
    }
    add_filter('thematic_postheader_posttitle', 'my_post_title');

    Still needs some styling :)

    Chris

    Btw.: Keep in mind .. each get_the_post_thumbnail / the_post_thumbnail will add two DB queries to your account! Don't use it on endless post lists!

    Posted 9 years ago #
  4. wownflutter
    Member

    So, If I were to copy this code, where would I paste it?

    Posted 9 years ago #
  5. Hobrecht
    Member

    It has to be pasted into the functions.php
    And: It works! Thanks Chris!
    But there are some questions.
    How do I make it clickable(php-newbie and afraid of it)?
    And it's also in each single post. How can I make it just visible when the posts are listet?
    Thanks in advance.

    Posted 9 years ago #
  6. wownflutter
    Member

    Okay, I pasted it into the function.php and it is on my server.

    Now, how do I implement this?

    Posted 9 years ago #
  7. Hobrecht
    Member

    That should be it.
    If you're writing a post there should be the possibility to select a thumbnail >>> http://justintadlock.com/blog/wp-content/uploads/2009/11/the-post-image.png
    If this post appears in a list at the frontend it shows the thumbnail.

    Posted 9 years ago #
  8. Try this one for the category pages:

    add_theme_support( 'post-thumbnails' );
    
    function my_post_title($title) {
    	if (is_category()) {
    		return get_the_post_thumbnail(NULL, 'thumbnail') . $title;
    	} else {
    		return $title;
    	}
    }
    add_filter('thematic_postheader_posttitle', 'my_post_title');
    Posted 9 years ago #
  9. Hobrecht
    Member

    Hi Chris.
    I guess it's working but I'm currently using another theme.
    Thank you anyway. Might use it later.

    Posted 9 years ago #
  10. rkread
    Member

    Hi Chris, Hoping you can help me out here. I've been trying to figure this out for days.

    I've implemented the above code (that you posted above) in my functions.php file; however, I'd like to change the default appearance on my category pages. The thumbnail appears above the post, including the title, like this:
    http://www.rkread.com/wp/?cat=9

    how might I change it so that either I have...

    1) the title and meta appears first, then the thumbnail floats left (underneath the title and meta), inset into to the excerpt text, something like this:
    http://makingitlovely.com/category/fabric/

    or..
    2) the thumbnail just floats left of all the entry text, including the title, meta and excerpt text. similar to this: http://blog.jasondunbar.com/

    thank you for any help!!

    Posted 9 years ago #
  11. rkread
    Member

    friendly bump

    Posted 9 years ago #
  12. (Cross posting: link to solution that worked for rkread: http://forums.themeshaper.com/topic/how-to-enclose-post-thumbnail-in-ltdivgt-to-modify-positioning#post-11203)

    Posted 9 years ago #
  13. dorabelle
    Member

    Its pretty easy, just do this: (in my opinion, the cleanest and simplest way to do it)

    1. Add a Custom Field, call it "Thumbnail". (in the Edit Post page)
    2. in the Value field, put the link to the image you want to use (you probably want to standardize the sizes of these thumbnails)
    3. drop the following code into your home.php file, (or whatever page) at the place you want your thumbnail to appear:
    <img <?php echo get_post_meta($post->ID, "Thumbnail", true);?> />

    thats it!

    maybe put the code before this
    <?php the_excerpt(__('Read more'));?><div style="clear:both;"></div>
    to have your thumbnail show right before the excerpt of that post.

    Posted 8 years ago #
  14. dorabelle
    Member

    I've been trying to get this code to work to change the banner based on category page, by changing the banner definition in the main style sheet. That isn't working. Does anyone know if you could define a banner (or whatever image) in a header to be controlled by a custom field? Its easy in theory...

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.