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.
Here’s an example of the featured image aligned to the left of the excerpt but below the entry title on all archive pages:
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:
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:
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:
- You can add the 2 lines of PHP code directly to a template file
- 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.
Was This Tutorial Helpful?