Can not Remove Archives and Meta from Sidebar

The theme is set up so that if a sidebar is inactive, default content will be shown (search form, monthly archives, and meta).

For example, the sidebar.php file:

<?php
/**
 * The Sidebar containing the main widget areas.
 *
 * @package WordPress
 * @subpackage Fruitful theme
 * @since Fruitful theme 1.0
 */
?>
<div id="secondary" class="widget-area" role="complementary">
    <?php do_action( 'before_sidebar' ); ?>
    <?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>

        <aside id="search" class="widget widget_search">
            <?php get_search_form(); ?>
        </aside>

        <aside id="archives" class="widget">
            <h1 class="widget-title"><?php _e( 'Archives', 'fruitful' ); ?></h1>
            <ul>
                <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
            </ul>
        </aside>

        <aside id="meta" class="widget">
            <h1 class="widget-title"><?php _e( 'Meta', 'fruitful' ); ?></h1>
            <ul>
                <?php wp_register(); ?>
                <li><?php wp_loginout(); ?></li>
                <?php wp_meta(); ?>
            </ul>
        </aside>

    <?php endif; // end sidebar widget area ?>
</div><!-- #secondary .widget-area -->

You can override the theme’s sidebar.php file by creating a child theme and adding your own customized sidebar.php file to it. E.g.:

<?php
/**
 * The Sidebar containing the main widget areas.
 *
 * @package WordPress
 * @subpackage Fruitful child theme
 * @since Fruitful child theme 1.0
 */
?>

<div id="secondary" class="widget-area" role="complementary">
    <?php do_action( 'before_sidebar' ); ?>
    <?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- #secondary .widget-area -->

The theme uses several sidebars (sidebar.php, sidebar-blogright.php, sidebar-homepage.php, sidebar-page.php, sidebar-single-post.php plus the store related sidebars, which are set up differently) so follow this procedure for each sidebar that you would like to modify using the appropriate sidebar name when calling dynamic_sidebar().

Leave a Comment