Free Tutorials Genesis Tutorials

Genesis: Align Featured Image Next To Title On Content Archive Pages

By default, Genesis enables you to align your featured images to the left or right of your content.

Go to Genesis > Theme Settings > Content Archives > Image Alignment where you can change the left and right alignment of your images.

image alignment - left and right of content excerpt

Here’s an example of the featured image aligned to the left of the excerpt but below the entry title on all archive pages:

image after title genesis archives

Align Image Left of Entry Title

You can re-position the image so its aligned to the left of the title in the entry header using this code in your child themes functions file. This code will effect any blog listings page, including archive, author, blog, category, search, and tag pages.

remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_header', 'genesis_do_post_image', 5 );

And here’s the result:

image left title genesis

Align Image Right of Entry Title

Changing the image alignment to right in the Genesis > Theme Settings > Content Archives will result in your featured image aligning to the right of the entry title in the entry header on all archive pages:

image right title genesis

But what if you only want the featured image aligned left or right of the title on the home page only or another archive? You can use this next code snippet to control which archives are effected.

Align Image Left or Right on Home Page Only

You have 2 choices:

  1. You can add the 2 lines of PHP code directly to a template file
  2. Or you can use the code in a custom function with conditional tag.

Here’s the code you can add to a new or existing home.php, front-page.php or category.php file in your child themes root directory to control which archive pages your featured images are aligned to the left or right of your titles.

remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_header', 'genesis_do_post_image', 5 );

I wrote about this topic last year briefly however thought it best to provide more flexible solutions on top of the fact Genesis now includes alignment of featured images using the Content Archive Settings which wasn’t the case last year.

Related Tutorials

Leave a Reply

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