0

I added only 3 Widgets to my sidebar, however when I set their visibility to hidden in post pages they disappear but ALL the default widgets appear. I want to remove the default widgets from appearing because I don't want any widgets on my post page. Here is the code that makes all the default widgets appear.

<div class="widget widget_search widget-widget_search">
  <div class="widget-wrap widget-inside">
    <?php get_search_form(); ?>
  </div>
</div>

<div class="widget widget_pages widget-widget_pages">
  <div class="widget-wrap widget-inside">
    <h3 class="widget-title"><?php _e( 'Pages', 'alkane' ); ?></h3>
      <ul><?php wp_list_pages('title_li='); ?></ul>
  </div>
</div>

<div class="widget widget_categories widget-widget_categories">
  <div class="widget-wrap widget-inside">
    <h3 class="widget-title"><?php _e( 'Categories', 'alkane' ); ?></h3>
      <ul><?php wp_list_categories('title_li='); ?></ul>
  </div>
</div>

<div class="widget widget_archive widget-widget_archive">
  <div class="widget-wrap widget-inside">
    <h3 class="widget-title"><?php _e( 'Archives', 'alkane' ); ?></h3>
      <ul><?php wp_get_archives('type=monthly'); ?></ul>
  </div>
</div>

<div class="widget widget_calendar widget-widget_calendar">
  <div class="widget-wrap widget-inside">
    <h3 class="widget-title"><?php _e( 'Calendar', 'alkane' ); ?></h3>
    <?php get_calendar(); ?>
  </div>
</div>

<div class="widget widget_recent_entries widget-widget_recent_entries">
  <div class="widget-wrap widget-inside">
    <h3 class="widget-title"><?php _e( 'Recent Posts', 'alkane' ); ?></h3>
      <ul><?php wp_get_archives('type=postbypost&limit=5'); ?></ul>
  </div>
</div>

<div class="widget widget_tag_cloud widget-widget_tag_cloud">
  <div class="widget-wrap widget-inside">
    <h3 class="widget-title"><?php _e( 'Tag Cloud', 'alkane' ); ?></h3>
    <?php wp_tag_cloud('smallest=10&largest=20&number=30&unit=px&format=flat&orderby=name'); ?>
  </div>
</div>

<div class="widget widget_text widget-widget_text">
  <div class="widget-wrap widget-inside">
    <h3 class="widget-title"><?php _e( 'About Alkane', 'alkane' ); ?></h3>
    <div class="textwidget"><?php printf( __( '%s', 'alkane' ), $alkane_theme_data['Description'] ); ?></div>
  </div>
</div>

<div class="widget widget_links widget-widget_links">
  <div class="widget-wrap widget-inside">
    <h3 class="widget-title"><?php _e( 'Blogroll', 'alkane' ); ?></h3>
      <ul><?php wp_list_bookmarks('title_li=&categorize=0'); ?></ul>
  </div>
</div>

<div class="widget widget_meta widget-widget_meta">
  <div class="widget-wrap widget-inside">
    <h3 class="widget-title"><?php _e( 'Meta', 'alkane' ); ?></h3>
      <ul>
        <?php wp_register(); ?>
        <li><?php wp_loginout(); ?></li>
        <li><a href="<?php bloginfo( 'rss2_url' ); ?>" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li>
        <li><a href="<?php bloginfo( 'comments_rss2_url' ); ?>" title="The latest comments to all posts in RSS">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li>
        <li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li>
        <?php wp_meta(); ?>
      </ul>
  </div>
</div>
  • theme details? Are they set as default widgets by code or they are there in widgets? – Kumar Aug 21 '14 at 13:40
  • I found out how to do it myself I just had to delete the static widgets with help from this website of course I looked at some previous questions. – user3351284 Aug 21 '14 at 13:42
  • Gr8 :), you can answer your question and mark it resolved. – Kumar Aug 21 '14 at 13:54
0

I have deleted the lines of code I mentioned above and only left the remaining code in sidebar.php. The problem was they were hard coded so they appear if visibility is set to hidden to the sidebar widgets.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.