Can't get feature image to float left of text on category page
-
I am trying to make a child theme for Twenty Twelve with a custom category page that looks something like this: https://laurenconrad.com/blog/cat/primp. Specifically, I would like to have the feature image to the left and the post title and excerpt to the right. I’ve tried scouring the internet for solutions but I just keep ending up with the text above or below the feature image. Below is my current attempt that is not working
I’ve tried creating a div class with this in the style.css:
.featuredImage { float: left; }
In my functions.php, I have created a new thumbnail size for the category pages:
if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 624, 9999 ); // default Post Thumbnail dimensions } if ( function_exists( 'add_image_size' ) ) { add_image_size( 'category-thumb', 300, 9999 ); //300 pixels wide (and unlimited height) }
Then in my content.php, I have the following:
<?php if ( is_search() || is_archive() || is_author() || is_tag() ) : // Only display Excerpts ?> <div class="featuredImage"> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('category-thumb'); ?></a> </div> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?>
I’m very inexperienced at this, so I could easily be missing something simple. Thank`you for any help in advance.
- The topic ‘Can't get feature image to float left of text on category page’ is closed to new replies.