Community Forums › Forums › Archived Forums › General Discussion › Mocha theme totally widgetize home page
Tagged: Mocha theme
- This topic has 30 replies, 4 voices, and was last updated 11 years, 2 months ago by PinkInk.
-
AuthorPosts
-
February 5, 2013 at 8:23 pm #18364PinkInkMember
Hi I am using the Mocha theme and I am attempting to totally widgetize my home page. No posts and no sidebar or content, just widgets.
I've registered my home widgets and all is working fine but I can't seem to work out how to remove the posts, content and sidebar area on the home page only?
I've noticed on the landing page.php there is a remove_action for header, nav and footer should I be adding something similar to the home.php page to remove the content_sidebar? Plus removing the grid loop as well?
Tiff
February 7, 2013 at 4:52 pm #18773PinkInkMemberAm I asking a silly question? would love some direction here.
Tiff
February 7, 2013 at 6:45 pm #18800SusanModeratorHi, Tiff:
No, it's not a silly question.
The mocha theme by default is set up like a blog, and will display your latest posts by default. Have you considered setting a static page as your home page? That might be the easiest way to have it set up, if you have no intention of showing posts on the page.
As for the sidebar, if you go to Genesis > Theme Settings > Default Layout, and select full width layout, your sidebars will disappear.
February 7, 2013 at 6:56 pm #18805PinkInkMemberHi Susan, thank you so much for you reply, I really appreciate it.
With regards to the home page, I understand the static page which I think I may have to do anyway but it still leaves me with the content and sidebar (or full content), I actually want to remove (or hide using display:none; in the CSS if necessary) the .content_sidebar, #content_sidebar_wrap etc form the home page only so that just the widgets display.
Is that making any sense? sorry for not being very clear.
Tiff
February 7, 2013 at 7:00 pm #18806SusanModeratorCan you please post a link to your site, so that I can look at your code?
February 7, 2013 at 7:01 pm #18807PinkInkMemberWould forcing a layout like this in the home.php page
genesis_set_default_layout(
'custom_layout'
);
then adding bellow to my CSS work?
.custom_layout{
display:none;
}
Tiff
February 7, 2013 at 7:03 pm #18808PinkInkMembermy site is in maintenance mode while under construction would you like me to send you the link and password?
Tiff
February 7, 2013 at 7:16 pm #18813AnitaKeymasterThis reply has been marked as private.February 7, 2013 at 7:27 pm #18816PinkInkMemberThis reply has been marked as private.February 7, 2013 at 7:36 pm #18819AnitaKeymasterDo you want the sidebars on the inside pages or are you wanting to remove them all together?
Love coffee, chocolate and my Bella!
February 7, 2013 at 7:43 pm #18820AnitaKeymasterHere is the code to remove the sidebar on the home only. Add this to the bottom of your functions.php file.
// remove sidebar from home add_action ('genesis_before_loop', 'remove_sidebar_home'); function remove_sidebar_home() { if (is_home() ) { remove_action ('genesis_after_content','genesis_get_sidebar'); } }
Love coffee, chocolate and my Bella!
February 7, 2013 at 7:49 pm #18821PinkInkMemberHi Anitac, thank you so much! yes trying to remove the sidebar and content from home page only.
that worked to remove my sidebar however the content is still there.
Tiff
February 7, 2013 at 8:16 pm #18827Hard Boiled GregMemberHi,
I'd like to help. Just so I can get caught up, are you using a home.php file? If you are, would you mind posting what is in there now?
Thanks,
HBG
Website: Hard Boiled Greg Twitter: @hbgreg
February 7, 2013 at 8:29 pm #18828PinkInkMember
<?php/** Add home slider */
add_action( 'genesis_before_content_sidebar_wrap', 'custom_welcome_text' );
function custom_welcome_text() {
genesis_widget_area( 'home-slider', array(
'before' => '<div class="home-slider">',
) );
}/** Add the home content section */
add_action( 'genesis_before_content_sidebar_wrap', 'mocha_home_content' );
function mocha_home_content() {/** Do nothing on page 2 or greater */
if ( get_query_var( 'paged' ) >= 2 )
return;genesis_widget_area( 'home-content', array(
'before' => '<div class="home-content widget-area">',
) );}
// remove sidebar from home
add_action ('genesis_before_loop', 'remove_sidebar_home');
function remove_sidebar_home() {
if (is_home() ) {
remove_action ('genesis_after_content','genesis_get_sidebar');
}
}
// remove content from home
add_action ('genesis_before_loop', 'remove_content_home');
function remove_content_home() {
if (is_home() ) {
remove_action ('genesis_after_content','genesis_get_content');
}
}
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs');
remove_action( ‘genesis_sidebar’, ‘genesis_do_sidebar’ );
remove_action( 'genesis_content_sidebar', 'genesis_do_content_sidebar');
remove_action( 'genesis_content_sidebar_wrap', 'genesis_do_content_sidebar_wrap');genesis();
Tiff
February 7, 2013 at 8:31 pm #18829PinkInkMemberthe bottom sections were just me trying anything out but they haven't worked so I'm removing
// remove content from home
add_action ('genesis_before_loop', 'remove_content_home');
function remove_content_home() {
if (is_home() ) {
remove_action ('genesis_after_content','genesis_get_content');
}
}
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs');
remove_action( ‘genesis_sidebar’, ‘genesis_do_sidebar’ );
remove_action( 'genesis_content_sidebar', 'genesis_do_content_sidebar');
remove_action( 'genesis_content_sidebar_wrap', 'genesis_do_content_sidebar_wrap');
Tiff
February 7, 2013 at 9:00 pm #18834PinkInkMemberI've gotten a little closer LOL I have added the following code.
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); // Removes breadcrumbs
remove_action( 'genesis_post_title','genesis_do_post_title' ); // Removes post title
remove_action( 'genesis_post_content', 'genesis_do_post_content' ); // Removes content
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
Which feels a little like deconstructing Lego block by block LOL I just have the content section left now
Tiff
February 7, 2013 at 9:01 pm #18835PinkInkMembersorry duplicate post
Tiff
February 7, 2013 at 9:30 pm #18842Hard Boiled GregMemberSorry for the delay, I thought I had subscribed to this thread. Typing a reply now.
Website: Hard Boiled Greg Twitter: @hbgreg
February 7, 2013 at 9:36 pm #18843PinkInkMemberThanks Greg, no problem, take your time!
Tiff
February 7, 2013 at 9:39 pm #18844Hard Boiled GregMemberThis should remove the sidebars and the content. I quickly tested it and it doesn't throw up any errors, but I didn't try it with all of your custom widget code. Feel free to remove anything from your home.php that you added to accomplish the same. Add it right after your opening php tag
add_action( 'genesis_meta', 'hbg_home_genesis_meta' ); /** * Removes content loop and forces page to full-width layout. * */ function hbg_home_genesis_meta() { remove_action( 'genesis_loop', 'genesis_do_loop' ); add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); }
Website: Hard Boiled Greg Twitter: @hbgreg
-
AuthorPosts
- The topic ‘Mocha theme totally widgetize home page’ is closed to new replies.