title: Wordpress - Display in Widget Category description of current post
body: <p>I'm using this plugin which displays the active category or subcategory description in a widget.</p>
  
  <p><a href="http://wordpress.org/support/plugin/category-description-widget" rel="nofollow">http://wordpress.org/support/plugin/category-description-widget</a></p>
  
  <p>This works great when clicking a category or subcategory either directly from the menu or another widget.</p>
  
  <p>However, i also wanted to show this widget when viewing current post as well.
  Any help would be greatly appreciated.</p>
  
  <p>Eg. let's say our category and sub-categories are structured accordingly:</p>
  
  <ul>
  <li>Geography<br />
  ---- Ocean<br />
  ---- Land<br /></li>
  </ul>
  
  <p><strong>This is how it currently works:</strong></p>
  
  <p>When i click on Geography, all posts under Geography is displayed.
  In the widget, the plugin displays the description for Geography.</p>
  
  <p>When i click on ocean, all posts under Ocean is displayed.
  In the widget, the plugin displays the description for Ocean.</p>
  
  <p><strong>I would like to add additional:</strong></p>
  
  <p>When I'm in a post under Ocean, the widget should display the description of Ocean.</p>
  
  <p><strong>Below is the plugin code:</strong></p>
  
  <pre><code>class Category_Description_Widget extends WP_Widget {
      public function __construct() {
          parent::__construct(
              'category_description_widget', // Base ID
              'Category Description Widget', // Name
              array( 'description' =&gt; 'A widget with the category description', ) // Args
          );
      }
      public function widget( $args, $instance ) {
          if(!is_tax() &amp;&amp; !is_category() &amp;&amp; !is_tag()){
              return false;
          }
          extract( $args );
          echo $before_widget;
          echo term_description();
          echo $after_widget;
      }
  }
  
  function category_description_widget_init(){
      register_widget('Category_Description_Widget');
  }
  
  
  add_action( 'widgets_init', 'category_description_widget_init');
  </code></pre>