In the comments section of my previous tutorial, a user wrote,
Yeah! Thanks! I would also like to know how to layout posts like this on the front page. I know it can be done, because I’ve seen theme’s use the “vertical split” layout.In this article I would like to share the code to display Posts in a checkered layout on the Posts page. By default, this is the homepage in WordPress. I also show how template_include filter can be used to apply this layout to other views like category archives. All the 'odd' entries (1st from the top, 3rd, 5th etc.) are set to show Posts' Featured image with Post info and Entry meta floated on the image at the left and Post title and excerpt at the right. For 'even' entries the order is switched.
Step 1Add the following in child theme's functions.php:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|// Register a custom image size for Home Checkered images|
|add_image_size( 'home-checkered', 1024, 614, true );|
Step 2Create a file named home.php in the child theme directory having the following:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.