November 6, 2019 at 11:35 am #494490
I want to remove the sidebar from the default page template by modifying the php file instead of using css. Trying to hack/customize the genesis free child theme to make it look the way I want. I created a new file fullwidth.php and put it in my child theme folder page-templates. Then I added this code:
// Removes sidebar.
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
Then in WP > edit page > page attributes > template, I toggled to "fullwidth". But when I view my page on the front end the sidebar is still there.
Help please?http://rs.new.rswoodwinds.com/November 6, 2019 at 1:58 pm #494493
To remove a sidebar, you have to unregister it. Genesis has a better way to make a page full width. Just change the layour for that page. You can do it from the page editor or in code: https://my.studiopress.com/documentation/snippets/admin-management/force-the-genesis-layout-settings/
November 6, 2019 at 3:08 pm #494496
Thank you so much for this great info. Question, if I follow the instructions in that link and apply the code to "Force full-width-content layout setting" in functions.php, does that affect all page templates? I was thinking of keeping the default template unchanged in case I want that sidebar on another page later on.
Seems to me I want to modify something in my fullwidth.php file, no?
Thanks again.November 6, 2019 at 4:10 pm #494499
Also, I just renamed fullwidth.php to inside-pages.php and now in WP > edit page > page attributes > template, I see only "Default Template" and "Landing" as page options. There is no "inside-pages.php" page template option. Can you help me understand how to properly add a custom page that has no sidebar? Thanks again.November 7, 2019 at 8:59 am #494526
@seashore you originally wrote:
I want to remove the sidebar from the default page template...
Are you trying to remove the sidebar completely from your website or are you trying to create a template of your own that does not have the Primary sidebar? Your responses are a little bit confusing.
November 7, 2019 at 9:29 am #494527
I would like to create a template of my own that does not have the Primary sidebar. I was thinking I could duplicate the existing default template then remove the sidebar, so I don't have to build the new page template from scratch.November 7, 2019 at 9:59 am #494529November 7, 2019 at 10:06 am #494531
How please, can I create a new page template that appears WP > edit page > page attributes > template, and has the same layout as the current default template but without the sidebar. I'm sorry I'm just confused why my question is coming across confusing.November 7, 2019 at 10:41 am #494533
You do not need a template. If you want the entire website to be full width, you simply add the code from this page - https://my.studiopress.com/documentation/snippets/admin-management/force-the-genesis-layout-settings/ which is:
//* Force full-width-content layout setting add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
If you want full width on the home page to remove the primary sidebar, you would need to locate the layout setting in front-page.php and modify that to be full width as indicated in the above code.
You do not need a template.
November 7, 2019 at 10:55 am #494536
Ok thank you, so I placed that code at the very bottom of functions.php file inside my child theme folder, and I now see fullwidth pages. But let's say in a week I want to create a page with a sidebar, what is the best way to do that please? Thank you!November 7, 2019 at 10:59 am #494537
@seashore I don't think you quite understand how Genesis works. If you want a full width page for a particular page - you select the full-width LAYOUT on the Edit screen. If you want a page or post with a sidebar - you select the content-sidebar or sidebar-content LAYOUT on the Edit Screen.
November 7, 2019 at 11:04 am #494538
I navigated to WP > Pages > edit page, and see "Layouts" where I can select prebuilt layouts but I do not want that. Is that what you meant by go to Edit screen and select full-width layout?November 7, 2019 at 11:31 am #494539
I think you are the person who has found their answer in Genesis Slack. You really were not presenting the question here in the same manner as you did there.
November 7, 2019 at 12:13 pm #494540
It's alright, thank you Anita, have a good day.
You must be logged in to reply to this topic.