Find out how to set the design with two sidebars as the default layout in a Genesis Framework child theme using code.
Genesis offers 6 different template models depending on how you combine the content with the primary and secondary sidebars.
In addition, this platform allows you to choose which format to use by default from the WordPress customizer.
However, you may find it useful to select a different layout depending on the type of entry.
For example, do you want the pages and portfolio to have a full width layout while the blog posts show 2 default sidebars by default?
With Genesis you can do this easily.
Snippet to force designs with two sidebars as default
Remember that, regardless of the fragment you choose, you must enter it at the end of the page template where you want it to have an effect (single.php, single-portfolio.php, archive.php… ) before genesis():
Use one of the following snippets according to the type of layout you want to show.
To fix the design with two sidebars on the right, copy this code:
To see this and another 919 code snippets of this website, login or subscribe here.
To set the default layout with two sidebars on the left, choose this code:
To see this and another 919 code snippets of this website, login or subscribe here.
And finally, to force the format with the secondary sidebar on the left and the primary sidebar on the right, choose the following snippet:
To see this and another 919 code snippets of this website, login or subscribe here.
When you place one of these codes in the template, each time you create a new entry or page it will be displayed in the format you have chosen.
This makes the task easier for the client, avoiding the need to select the right design for each type of entry.
If you prefer, you can also choose the full width layout as a predefined option.
Conclusions
Use one of the snippets above to get your Genesis child theme pages or posts to show 2 sidebars by default.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂