• Resolved 008Rohit

    (@008rohit)


    I’m using 3.6 beta4 on my yet-to-be-launched site: http://rohitpalit.com

    I’m also using the ‘Twenty Thirteen’ theme.

    The problem is very simple actually. I don’t want the traditional footer (containing ‘main’ sidebar widgets) to appear in the homepage (static). I want it to appear on every other single page.

    So, essentially, it’d be really wise, IMO, to create a different sidebar or footer for that specific page (static homepage). When I try to do that from the child theme and use child’s functions.php to register the new sidebar, it doesn’t work. Shows the code when the website is opened. However, I was successfully able to register it from within the default functions.php

    Here’s what the code looks like in the functions.php of Twenty Thirteen:

    function twentythirteen_widgets_init() {
    	register_sidebar( array(
    		'name'          => __( 'Main Widget Area', 'twentythirteen' ),
    		'id'            => 'sidebar-1',
    		'description'   => __( 'Appears in the footer section of the site', 'twentythirteen' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h3 class="widget-title">',
    		'after_title'   => '</h3>',
    	) );
    
    	register_sidebar( array(
    		'name'          => __( 'Secondary Widget Area', 'twentythirteen' ),
    		'id'            => 'sidebar-2',
    		'description'   => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h3 class="widget-title">',
    		'after_title'   => '</h3>',
    	) );
            }

    And I try to add this in the functions.php of the child theme:

    function twentythirteen_widgets_init() {
    	register_sidebar( array(
    		'name'          => __( 'Main Widget Area', 'twentythirteen' ),
    		'id'            => 'sidebar-1',
    		'description'   => __( 'Appears in the footer section of the site', 'twentythirteen' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h3 class="widget-title">',
    		'after_title'   => '</h3>',
    	) );
            }

    I’d really love if this works for real. If anyone can tell me an alternative way to achieve what I want, I’d be grateful as well. I need the footer not to show any widget on the blog homepage only but it does NEED to be present. I can remove the <?php get_sidebar( 'main' ); ?> part from footer.php but that affects all the pages. I hope someone will come up with a solution.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Would it not be easier to use is_home or is_front-page conditional in child theme footer.php to not load the sidebar ‘main’?

    Thread Starter 008Rohit

    (@008rohit)

    Nevermind, (I think) this is solved. Created a footer-blank.php and a page-‘id’.php and made the page-‘id’.php load the custom footer-blank.php instead of the theme’s footer-main.php

    The footer-blank.php looks like this:

    <div id="secondary" class="sidebar-container" role="complementary"></div>

    And it pretty much did it. You can check my site’s homepage now: http://rohitpalit.com

    The page containing the blog posts (http://rohitpalit.com/blog/) is showing the theme’s default footer.

    This looks pretty good, have you considered stretching the content area out a little wider? I’m just beginning to really explore twenty thirteen.

    Planning on creating a full page template that can be used for the front “static” page.

    Thread Starter 008Rohit

    (@008rohit)

    The home page content area is already a bit wider than default. I prefer the narrow layout for reading convenience.

    Great idea about creating a full page template for the static front page. Let me know if you implement it soon.

    I would like to do exactly what 008Rohit has done but would appreciate some guidence. I have done some editing of themes but I do not know how to add a footer-blank.php and a page-‘id’.php and made the page-‘id’.php load the custom footer-blank.php instead of the theme’s footer-main.php

    Could anyone guide me please

    Thread Starter 008Rohit

    (@008rohit)

    Here’s a zipped version of my theme files: http://pastebin.com/jx8mAqvt

    Let me know if you need any further help. 🙂

    Many thanks

    Thread Starter 008Rohit

    (@008rohit)

    Happy to be of help. 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Twenty Thirteen Theme – can't use register_sidebar in child theme’ is closed to new replies.