• Hello,

    I did some css modifications on my website, so that a certain category is displayed different on the frontpage (smaller image, smaller font, etc).

    Here’s what I added:

    .category-linkdump .post-title {
        font-size: 18px;
        text-align: right;
    }
    
    .category-linkdump .post-thumbnail {
        width: 30%;
    }

    Now, the website resizes the thumbnails for that category from 520×292 to 134×75.

    But my theme provides a 190×106 version of every image, so I want to use that one for the specific category.

    This is what I did (and it didn’t work, that’s why I’m here). I changed:

    <?php if ( has_post_thumbnail() ): ?>
    <?php the_post_thumbnail('split-medium'); ?>
    <?php elseif ( ot_get_option('placeholder') != 'off' ): ?>
    <img src="<?php echo get_template_directory_uri(); ?>/img/thumb-medium.png" alt="<?php the_title(); ?>" />
    <?php endif; ?>

    to:

    <?php if is_category( 'linkdump' ): ?>
    <?php the_post_thumbnail('thumbnail'); ?>
    <?php elseif is_category( 'Stof' ): ?> 
    <?php the_post_thumbnail('split-medium'); ?>  
    <?php endif; ?> 

    What did I do wrong? My theme is ‘Split’ by Alexander Agnarson.

    Hope anyone can help!

Viewing 1 replies (of 1 total)
  • Thread Starter wh82

    (@wh82)

    I fixed it by using in_category instead of is_category:

    <?php
    if ( in_category('linkdump') ) {
        the_post_thumbnail('thumbnail');} 
    else {
        the_post_thumbnail('split-medium');}
    ?> 
Viewing 1 replies (of 1 total)
  • The topic ‘change thumbnail size for certain category’ is closed to new replies.