If your WordPress Homepage is showing posts, but the layout is not good enough, you can use Content Views (free version) to show posts in beautiful Grid layout.
This document will require coding skills (how to do it without coding?).
If you are ready, let’s start.
Pre-requisite: Create child theme
To show Grid of posts in homepage, we will need to modify a file of the active theme. But these modifications will be overridden in next theme update. That is why we should create a child theme.
There are many plugins which help you to create child theme quickly. So I will not cover it here.
I. Which file to modify
Please open directory of the parent theme (not the child theme which you have created).
If this file front-page.php exists
=> modify file front-page.php
Otherwise, in your Admin dashboard, please open Settings >> Reading menu, then check the Front page displays setting.
a. If the first option Your latest posts is selected
=> modify file home.php (if it exists), otherwise modify file index.php
b. If the second option A static page is selected
Open the page which is selected as Front page (in screenshot, the selected page is “Home”), then check the page template setting:
- If that page uses Default Template
=> Modify file page.php (if it exists), otherwise modify file index.php
- If that page uses a custom page template
=> Modify the custom template file
II. How to modify
Please open the file, then:
1. Before while loop
while statement, paste this code:
/* Content Views: show custom grid on homepage */ if ( is_front_page() ) : echo do_shortcode( "[pt_view id=VIEW_ID]" ); else :
(Please replace VIEW_ID with ID of your Grid View)
This code must be put below the closest PHP opening tag
2. After while loop
endwhile, paste this code:
This code must be put above the closest PHP closing tag
After modifying, you should have something like this:
3. Active the child theme
The parent theme was active.
After modifying, please activate the child theme to apply the change to your site.
This solution above is not guaranteed to work on ALL themes, because of many themes have complex mechanism to display posts in homepage.
To replace posts layout of any page (Home, Blog, Search results, Category…) by a beautiful Grid, Pinterest… layout:
- in ANY theme
- without modifying theme file
the Content Views Pro will help you.
Thank you for reading.