How do I hide the left sidebar on the static homepage?

How do I hide the sidebar on the homepage/static landing page only on the FrameMarket Theme?

  • Timothy
    • Chief Pigeon

    Hey there.

    Well you may like to edit the home page code to target the class:

    #content {
    width: 960px;
    }
    #sidebar, .side {
    display: none;
    }

    This CSS would apply to all, but the basics are there. You could create a child theme and add some specific class which you could target.

    Hope this helps.

    Take care.

  • Erik
    • Site Builder, Child of Zeus

    alternately, you could simply run a check and inject style rules directly onto the homepage via a plugin file thus negating making a child theme or anything..

    function remove_sidebar_on_homepage() {
    if(is_home()) { echo '<style>#content {width: 960px;}#sidebar, .side {display: none; }</style';}
    }
    add_action('wp_head', 'remove_sidebar_on_homepage');

    If this fails, your css sheets are most likely being called after the wp_head hook, in which case use another hook, possibly get_sidebar ..

    I've packaged this up as a plugin and attached it to this post. Let me know how it works out.

    *Edit* wont let me upload a php file or as a txt, so just copy paste it from here into a php file in your /plugins/ dir and activate..

    *plugin Code Below*:

    <?php
    /*
    Plugin Name: EGH Remove Sidebar On Homepage
    Version: 1.0b
    Plugin URI:
    Description: Remove the sidebar on the homepage only via css injection
    Author: Erock
    Author URI: http://eghsolutions.com
    */
    function remove_sidebar_on_homepage() {
    if(is_home()) { echo '<style>#content {width: 960px;}#sidebar, .side {display: none; }</style';}
    }
    add_action('wp_head', 'remove_sidebar_on_homepage');
    ?>

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.