If your website has thousands of articles like our website, you’ll end up finding a design which will support showing multiple lists of articles as static part followed by the regular design of blog’s homepage. It is a retro-style, thesitewizard.com is a good example of that style. This article is going to help the webmasters who are willing to afford a theme designer. Although this guide is for Studiopress Genesis users, the rest of the WordPress users can use a similar method to get a semi-static home page with minimal coding work and maximal flexibility.
Relationship with our older guides
Our previous guide to create a Semi-Static, Customizable Homepage for WordPress Genesis is slightly outdated in modern world as the new WordPress visual editor has changed the entire customizing experience with blocks. However, we will keep the basic part of that guide (hence that guide is important to you). My personal website abhishekghosh.com (which is under development at this moment) is using Genesis Authority Pro as base theme. The complex to design home page of my personal website is easily editable because of the the new editor Gutenberg and Atomic Blocks plugin. Genesis Authority Pro gave me the idea to use a page’s content on home page by just using few plugins and minimal PHP and CSS.
Required plugins and snippets
To use this guide, you’ll need the Genesis Simple Hooks plugin as the minimal resource. The area we want to work is genesis_before_content_sidebar_wrap
hook (from this webpage you’ll get a visual idea of which Genesis hook is for which are for where). First, we need to wrap whatever we want to put inside two lines of PHP snippet :
---
The first one will ensure that the code below is not shown on other than the page one of the front page. endif
is for ending the loop. You’ll need a custom div class (which I have named pagewrap-tcw
) to adjust margin, padding etc :
You’ll need few lines of CSS, which is like below in my case :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | <style> #pagewrap-tcw { padding: 3em; width: 1160px; margin: 20px auto; background-color: #FFFFFF; background-image: none; background-origin: padding-box; background-position: 0% 0%; background-repeat: repeat; background-size: auto; border-bottom-color: #DDDDDD; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #DDDDDD; border-left-style: solid; border-left-width: 1px; border-right-color: #DDDDDD; border-right-style: solid; border-right-width: 1px; border-top-color: #DDDDDD; border-top-style: solid; border-top-width: 1px; box-sizing: border-box; color: #333333; display: block; font-family: proxima-nova; font-size: 18px; line-height: 29.34px; } .pagewrap-tcw ol, ul, li { margin-left : 5px; padding-left: 5px; list-style-position: inside !important; } @media screen and (max-width: 960px) { #pagewrap-tcw { width: auto; padding: 1em; } } @media screen and (max-width: 480px) { h1 { font-size: 2em; } } </style> |
You can insert the above stylesheet either within the same hook or some plugin which conditionally injects codes on the homepage, like Head, Footer and Post Injections plugin.
Create a custom page content
Now, you have to create a page which will have the content you have to show on the home page (like our this page). WordPress editor will make the thing as much visual as possible. Apart from that, Genesis has in-built column class for posts. This is an example of two-column content (you can use HTML in the text tab of WordPress editor):
1 2 3 4 5 6 7 8 9 10 11 | <div class="one-half first"> Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. </div> <div class="one-half"> Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet. </div> |
Our final code for front page
The following code will show up your custom page content :
We will need to insert the actual Page ID in the ID# above. So, for example, below is a valid snippet for the page with PAGE ID 5670:
So our final snippet for genesis_before_content_sidebar_wrap
within the Genesis Simple Hooks plugin will be:
And of course, you’ll need the above CSS :
1 2 3 4 5 6 | <style> #pagewrap-tcw { ... ... } </style> |
Final words
This is how you can avoid going through creating a template for the home page and use a visually edible page content. As long you are using some cache plugin, your page loading time will not hugely increase. Creating a template for the home page the technically correct approach for customization of the home page but not all of the users have that time to dedicate. This dirty method is giving an “advanced” home page which is possible to edit every hour and after inserting the code once at least for testing, you have a lot of flexibility. Converting this thing to a template is not difficult.