Show Archive Page Featured Images on Left of Post Extract

Written by Dan Mossop

An earlier post covered how to show blog module featured images to the left of the post text in the Divi theme. Here's the equivalent CSS for doing the same thing on the standard category / archive / search pages:

/* Place category / archive / search images on left of text */
/* src: https://divibooster.com/show-archive-page-featured-images-on-left-of-post-extract/ */
@media only screen and (min-width: 981px) {

	body.archive .et_pb_post img,
	body.search .et_pb_post img {
		height: 180px !important;
		width: 335px;
		float: left;
		left: 0;
		margin-right: 25px;
	}

	body.archive .et_pb_post,
	body.search .et_pb_post { 
	    clear: both; 
	    min-height: 180px 
	}

	/* Move text over when there is no thumbnail */
	body.archive .et_pb_post:not(.has-post-thumbnail) {
	    margin-left: 360px;
	}

}
The final block of CSS that starts "/* Move text over…" re-positions the text even if there isn't an image available, so that the text lines up the same for every item. You may wish to delete this if you'd like to keep extracts with no image as full width.

We may earn a commission when you visit links on our website.

Unlock the Full Potential of Shortcodes in Divi!

Empower your Divi site with the Divi Shortcode Enabler. This plugin allows shortcodes to run effortlessly in various Divi module fields, enhancing functionality and customization across your site.

Latest Posts

Add a Visible Shadow to Divi Gallery Lightbox Arrows

Give the lightbox navigation arrows in your Divi galleries a stylish pop and improve their visibility by adding a shadow beneath the arrows. This quick guide will show you how to make your navigation arrows stand out against the lightbox overlay.Add a Visible Shadow...

Adjust Lightbox Arrow Size in Divi Gallery

Customize the size of the navigation arrows that appear in your gallery lightbox so they’re easier to see and aligned with your site’s design. Whether you want larger, more accessible controls or a subtler look, setting a precise arrow size creates a more polished...

Change Lightbox Arrow Color in the Divi Gallery Module

Make the lightbox navigation arrows in your Divi Gallery match your brand and stand out against your images by assigning a custom color. This improves visual consistency, enhances accessibility with better contrast, and elevates the overall browsing experience for...

Change the Divi Gallery Module Grid Image Scaling

Divi’s Gallery module offers a great way to showcase images, but it can sometimes stretch or crop them in unwanted ways. This article explains how to manage the module’s image scaling behavior to ensure your images are displayed at the correct size and aspect...

Set Custom CSS IDs for Individual Divi Accordion Items

Assigning unique CSS IDs to specific Divi Accordion items allows for precise control over styling, targeting, and linking within your page content. This ability is particularly useful when you want to apply custom designs or create anchor links to particular accordion...

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

5 Comments

  1. Recently Fixed one of my clients issues thanks man

    Reply
  2. Hey, Dan. This works great, but is there a way to maintain the proper aspect ratio on the thumbnails of the featured images? I've made some adjustments to the height to accommodate a tall image on a new post, and now it's (obviously) stretching thumbnails for other posts on the page. ???

    Reply
    • Hey Bill! You can use the object-fit CSS property for this, e.g.

      body.archive .et_pb_post img,
      body.search .et_pb_post img {
          object-fit: cover !important;
      }
      

      The width / height you have specified defines a "bounding box" area for the image and normally the image is stretched / shrunk to fit this area exactly (equivalent to "object-fit: fill"). A value of "cover" instead preserves the aspect ratio of the image and generally results in the image being resized and cropped in one of its dimensions so that the result covers the bounding box without any distortion. Another value you could use is "contain" which ensures that the aspect ratio is maintained and the image shrunk to fully fit within the bounding box (which means the image may be smaller in one of its dimensions that the bounding box).

      I hope that makes sense!

      Reply
      • Hello Dan, that was exactly what I needed. Object fit solution solved my problem with streched featured image on Divi archive pages.
        Thank you so much!!!

        Reply
        • Great! I'm glad that helped, and thanks for letting me know!

          Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.