• I am very new to WordPress and have been struggling with a Child Theme I’ve created based on Gridsby. I want to get rid of the widget sidebar and have the page text/images take up the entire space. I’ve searched for ways to do this and have followed the directions, but every time I modify the functions.php file, I get errors and end up having to reinstall the functions on the server. It’s driving me nuts and I don’t know how to fix the problem. Can anyone please help? Pretty please? Here is the code on the functions.php file. What am I doing wrong?

    <?php
    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘child-style’, get_stylesheet_uri(), array( ‘parent-style’ ) );
    }

    <?php
    add_filter( ‘sidebars_widgets’, ‘disable_all_widgets’ );

    function disable_all_widgets( $sidebars_widgets ) {
    if ( is_home() )
    $sidebars_widgets = array( false );
    return $sidebars_widgets;
    }
    ?>

Viewing 12 replies - 1 through 12 (of 12 total)
  • Theme Author modernthemesnet

    (@modernthemesnet)

    Hi rloftis,

    Try adding that code without the <?php and ?>

    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘child-style’, get_stylesheet_uri(), array( ‘parent-style’ ) );

    add_filter( ‘sidebars_widgets’, ‘disable_all_widgets’ );

    function disable_all_widgets( $sidebars_widgets ) {
    if ( is_home() )
    $sidebars_widgets = array( false );
    return $sidebars_widgets;
    }

    Thread Starter rloftis

    (@rloftis)

    Thanks so much for responding, though I hate to say…that edit didn’t work. I still have the sidebar area and I’m getting a weird message above the website now. Any other suggestions? I really do appreciate your help.

    Thread Starter rloftis

    (@rloftis)

    This may be a stupid question, but do I need to change any of the text above to reflect the parent/child names? So do I need to say, for example,

    wp_enqueue_style( ‘gridsby’, get_template_directory_uri(). ‘/style.css’ );
    wp_enqueue_style( ‘gridsby-child’, get_stylesheet_uri(), array( ‘gridsby-style’ ) );

    Forgive me, I’m so, so new to this.

    Thread Starter rloftis

    (@rloftis)

    ruthloftis.com

    Thread Starter rloftis

    (@rloftis)

    I figured out the child vs parent theme problem, but am still having issues removing the sidebar area. Anyone?

    Theme Author modernthemesnet

    (@modernthemesnet)

    Hi rloftis,

    I am assuming you got your method from the Justin Tadlock article here: https://justintadlock.com/archives/2009/03/06/disable-widget-areas-without-touching-theme-templates

    If so, that is the extent of my knowledge on this issue. You might have more of an audience that can help out if you post in one of the main WordPress support forums: https://www.ads-software.com/support/

    Sorry!

    Thread Starter rloftis

    (@rloftis)

    I’ve tried posting in the main WordPress support forum and someone keeps deleting it and telling me to move it under Gridsby. Here is my functions code in its entirety:

    <?php
    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘gridsby-style’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘gridsby-child-style’, get_stylesheet_uri(), array( ‘gridsby-style’ ) );
    }

    ?>

    <?php
    add_filter( ‘sidebars_widgets’, ‘disable_sidebar-1_widgets’ );

    function disable_sidebar-1_widgets( $sidebars_widgets ) {

    if ( is_single() )
    $sidebars_widgets[‘sidebar-1’] = false;

    return $sidebars_widgets;
    }
    ?>

    I’m getting a message saying I have en extra ‘-‘ in line 10, but the ID of the widget I want removed is called sidebar-1. Not sure what else to do and am pulling my hair out over this.

    You need to remove the call to the sidebar in the template file you are modifying – and then modify CSS to get rid of the space. Removing the widgets doesn’t remove the sidebar.

    If so, that is the extent of my knowledge on this issue. You might have more of an audience that can help out if you post in one of the main WordPress support forums: https://www.ads-software.com/support/

    And the above is incorrect – this theme forum is the place for this kind of question.

    Basically, make a custom template in your child theme that does not have the call to the side bar in it – start by copying the template file you want to change…

    https://codex.www.ads-software.com/Page_Templates#Custom_Page_Template

    Thread Starter rloftis

    (@rloftis)

    Oh my goodness, just slapped myself in the forehead. I just now realized there was a page template for full width. I must need more sleep. Thanks for bearing with me.

    Theme Author modernthemesnet

    (@modernthemesnet)

    I’m sorry I must have misunderstood your issue originally. Yes, we have a full width template for pages which you would like no sidebar. Sorry!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Problems removing widget areas’ is closed to new replies.