Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove Simple Sidebar from home.php
Tagged: Metro, remove header
- This topic has 9 replies, 3 voices, and was last updated 10 years, 11 months ago by optimus203.
-
AuthorPosts
-
March 29, 2013 at 7:22 am #31904xtegoMember
I previously removed the primary sidebar from home.php using the following line:
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
This worked great, however, as I continued to work on the site it became clear to me that I was going to have to use different sidebars on different pages. I added Genesis Simple Sidebars. This was a perfect solution for what I needed. However, now the primary sidebar is back on my home page. Apparently the line above has no bearing when you are using simple sidebars. What do I need to do to remove the primary sidebar generated by simple sidebars on the homepage only (home.php)? I am assuming it is another simple one-liner, but i'm having trouble figuring it out. Can anyone help me out?
Thanks in advance!
March 29, 2013 at 7:36 am #31909Brad DaltonParticipantYou'd need a conditional tag.
!is_home()
Or try this: http://wordpress.org/extend/plugins/genesis-layout-extras/
March 29, 2013 at 7:42 am #31911xtegoMemberGenesis Layout Extras would work nicely, however, I need to maintain the secondary sidebar. There is no option for "Content-Secondary" that I see.
Can you explain where I would use the conditional tag?... (you'll have to forgive me, I'm not much of a coder)
Thanks!
March 29, 2013 at 7:58 am #31914Brad DaltonParticipantYou'd need to post this in the plugin forum and David will answer you quickly. Its to do with the plugin.
March 29, 2013 at 8:25 am #31919xtegoMemberI shouldn't have to use Genesis Layout Extras. All I have to do is remove the Primary Sidebar from one page. I've done it before with a single line added to home.php when I was using the default sidebars. Simple Sidebars obviously has a different name for the action. I'm trying to figure out what that is.
I've tried adding the following line to home.php, but to no avail:
remove_action('genesis_sidebar', 'ss_do_sidebar');
March 29, 2013 at 8:41 am #31922xtegoMemberI figured it out. I made changes to genesis-simple-sidebars/plugin.php. I replaced these lines:
function ss_sidebars_init() {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
add_action( 'genesis_sidebar', 'ss_do_sidebar' );
add_action( 'genesis_sidebar_alt', 'ss_do_sidebar_alt' );}
with this (based off of your original suggestion):
function ss_sidebars_init() {
if (!is_home()) {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
add_action( 'genesis_sidebar', 'ss_do_sidebar' );
add_action( 'genesis_sidebar_alt', 'ss_do_sidebar_alt' );}
}
This, in effect, maintains the standard sidebars for the home page, while all other pages get simple sidebars. Thanks for pointing me in the right direction.
March 29, 2013 at 8:49 am #31924Brad DaltonParticipantYou could filter it out on the homepage using a conditional tag in a custom function.
Just remember to copy that file locally so you can upload it when the plugin updates. Not really best practice.
January 19, 2014 at 8:31 am #85870optimus203MemberSo is there a custom function solution for this problem? I have the same issue and would like to try to avoid modifying the plugin code.
January 24, 2014 at 11:57 pm #86922Brad DaltonParticipantTry this:
//* Force full width content layout add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
January 25, 2014 at 12:48 pm #86982optimus203MemberThanks Brad. That was the filter I found on another site. Works like a charm. Thanks for the time and info.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.