Categories

Featured templates

WordPress. How to manage hidden widgets

Kate Daniels October 24, 2014
Rating: 5.0/5. From 2 votes.
Please wait...

This tutorial will show you how to remove hidden widgets from sidebar in WordPress based on CherryFramework.

WordPress. How to manage hidden widgets

Hidden widgets are displayed in sidebar area of the posts pages when Sidebar widget area is empty.

Default hidden widgets are the following: Search , Navigation, Archives and Meta.

WordPress_How_to_manage_hidden_widgets

  1. Open your WordPress installation directory and navigate to wp-content\themes\CherryFramework folder.

  2. Copy sidebar.php from CheryFramework folder to \themeXXXXX folder (where XXXXX is your actual theme number). This will keep your changes if CherryFramework is updated.

  3. sidebar.php file contains the following code:

    <?php
      /**
      * Sidebar Name: Static Sidebar
      */
      ?>
    <?php if ( ! dynamic_sidebar( theme_locals("sidebar") )) : ?>
      <div id="sidebar-search" class="widget">
      <?php echo '<h3>' . theme_locals("search") . '</h3>'; ?>
      <?php get_search_form(); ?> <!-- outputs the default WordPress search form-->
      </div>
     <div id="sidebar-nav" class="widget menu">
      <?php echo '<h3>' . theme_locals("navigation") . '</h3>'; ?>
      <?php wp_nav_menu( array('menu' => 'Sidebar Menu' )); ?> <!-- editable within the WordPress backend -->
      </div>
     <div id="sidebar-archives" class="widget">
      <?php echo '<h3>' . theme_locals("archives") . '</h3>'; ?>
      <ul>
      <?php wp_get_archives( 'type=monthly' ); ?>
      </ul>
      </div>
     <div id="sidebar-meta" class="widget">
      <?php echo '<h3>' . theme_locals("meta") . '</h3>'; ?>
      <ul>
      <?php wp_register(); ?>
      <li><?php wp_loginout(); ?></li>
      <?php wp_meta(); ?>
      </ul>
      </div>
    <?php endif; ?>
    
    

    As you can see from the file, each widget has its own code in the file.

    1. Search widget:

      <div id="sidebar-search" class="widget">
        <?php echo '<h3>' . theme_locals("search") . '</h3>'; ?>
        <?php get_search_form(); ?> <!-- outputs the default WordPress search form-->
      </div>
      
    2. Navigation widget:

      <div id="sidebar-nav" class="widget menu">
        <?php echo '<h3>' . theme_locals("navigation") . '</h3>'; ?>
        <?php wp_nav_menu( array('menu' => 'Sidebar Menu' )); ?> <!-- editable within the WordPress backend -->
      </div>
      
    3. Archives widget:

      <div id="sidebar-archives" class="widget">
        <?php echo '<h3>' . theme_locals("archives") . '</h3>'; ?>
        <ul>
        <?php wp_get_archives( 'type=monthly' ); ?>
        </ul>
      </div>
      
    4. Meta widget:

      <div id="sidebar-meta" class="widget">
        <?php echo '<h3>' . theme_locals("meta") . '</h3>'; ?>
        <ul>
        <?php wp_register(); ?>
        <li><?php wp_loginout(); ?></li>
        <?php wp_meta(); ?>
        </ul>
      </div>
      
  4. Remove the code or comment it out to disable hidden widget in the sidebar.

Feel free to check the detailed video tutorial below:

WordPress. How to manage hidden widgets

Professional Wordpress Templates
This entry was posted in WordPress Tutorials and tagged hidden, php, widget, WordPress. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket