• I’ve looked all around the forums for an answer to this but it seems each time someone posted the question there was no answer… at least on the topics I’ve managed to find.

    I need to make a sidebar that displays the posts for a custom post types by month. Exactly the same as the usual default WP style where you have the <h2> title followed by a list of months and years.

    I tried this, thinking it would work out… but it did not…

    <?php
    $taxonomy     = 'cnews';
    $type         = 'monthly';
    $show_count   = 0;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 1;      // 1 for yes, 0 for no
    $title        = '';
    $empty        = 0;
    
    $arcmonthly = array(
      'taxonomy'     => $taxonomy,
      'type'         => $type,
      'show_count'   => $show_count,
      'pad_counts'   => $pad_counts,
      'hierarchical' => $hierarchical,
      'title_li'     => $title,
      'hide_empty'   => $empty
    );
    ?>
    
    <h2 class="cnews-sb-head">... By Month ...</h2>
    
    <ul>
    <?php wp_get_archives( $arcmonthly ); ?>
    </ul>

    This is due tomorrow for work and any help you can give me is greatly appreciated. Thanks all!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Monthly Archive for Custom Post Type’ is closed to new replies.