WordPress.org

Support

Support » How-To and Troubleshooting » Issue displaying Sidebar Widget Archive/Cat Post Counts

Issue displaying Sidebar Widget Archive/Cat Post Counts

  • makingtrails
    Member

    @makingtrails

    Issue displaying Sidebar Widget Archive/Cat Post Counts

    I have a current problem with how my theme displaying post counts in the Category/Archive sidebar widgets.

    Instead of them displaying like this:

    October 2009 (0)
    November 2009 (1)
    December 2001 (2)

    They display on a separate line like this:

    October 2009
    (0)
    November 2009
    (1)
    December 2009
    (2)

    This is the same for Categories as well as archives.

    Is this an issue with my sidebar.php in my theme?

    Here is the code:

    <div id="sidebar">
    <ul> 
    
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    
    <?php
        global $notfound;
        if (is_page() and ($notfound != '1')) {
            $current_page = $post->ID;
            while($current_page) {
                $page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
                $current_page = $page_query->post_parent;
            }
            $parent_id = $page_query->ID;
            $parent_title = $page_query->post_title;
    
            // if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_status != 'attachment'")) {
            if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_type != 'attachment'")) {
        ?>
    <h3 class="sidebartitle"><?php echo $parent_title; ?>
      <?php _e('Subpages'); ?>
    </h3>
    <ul class="list-page">
      <?php wp_list_pages('sort_column=menu_order&title_li=&child_of='. $parent_id); ?>
    </ul>
    <?php } } ?>
    
      <h2>Search</h2>
    
      <div id="searchdiv">
    
        <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    
          <input type="text" name="s" id="s" size="15"/>
    
          <input name="sbutt" type="submit" value="Go" alt="Go"  />
    
        </form>
      </div>
    
       <h2>
    
       <?php _e('Calendar'); ?>
      </h2>
    <?php get_calendar(); ?>
    
      <ul>
    
      <h2>
    
       <?php _e('Categories'); ?>
      </h2>
      <ul>
    
         <?php wp_list_categories( $args ); ?> 
    
      </ul>
      		<h2><?php _e('Archives');?></h2>
    	<ul>
    
    	 <?php wp_get_archives('type=monthly'); ?>
    
    </ul>
      <ul>
    
        <?php get_links_list(); ?>
    
      </ul>
    
      <h2>
    
        <?php _e('Meta'); ?>
    
      </h2>
    
      <ul>
    
        <?php wp_register(); ?>
    
         <li>
    
          <?php wp_loginout(); ?>
    
        </li>
    
        <?php wp_meta(); ?>
    
      </ul>
    
    <br />
    </ul>
    <?php endif; ?>
    </div>

    Would be grateful for any advice.

    Thanks

    J

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Issue displaying Sidebar Widget Archive/Cat Post Counts’ is closed to new replies.