WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Eleven
Featured image: setting, showing and styling (1 post)

  1. frons79
    Member
    Posted 1 year ago #

    Hi there, I've created a child-theme in which I'm trying to implement some features for my webpage, unfortunately with no results yet.

    What I'm looking for is, after uploading a Featured Image for a post, have it displayed on the home page at a smaller size (100px square), floating left and the excerpt of the post on the right. On the post itself having a bigger size (200px square), always floating left with the content on the right (and the title on top of everything).

    This is what I added to the functions.php file

    <?php // post thumbnail support
    	add_image_size( 'home-thumb', 100, 100); // Home page thumbnail
    	add_image_size( 'post-thumb', 200, 200); // Single post thumbnail
    ?>

    content.php (after <div class="entry-content">)

    <?php if ( has_post_thumbnail()) : ?>
        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php the_post_thumbnail('home-thumb'); ?></a>
    <?php endif; ?>

    single.php

    <?php while ( have_posts() ) : the_post(); ?>)
    <?php the_post_thumbnail( 'post-thumb' ); // Adds the featured image to the single post ?>

    style.css

    img.attachment-post-thumb, img.attachment-home-thumb {
    	float:left;
    	border:2px double #000;
            margin:7px 7px 0 0;
            padding:2px; }

    What I'm getting is the two images ON TOP of the title and post content (100px for the home and 200px for the single post), but I cannot style'em at all (making them float on the left with content on the right and everything BELOW the title itself).
    Any working suggestion?

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic