WordPress.org

Ready to get started?Download WordPress

Forums

Code for Archives widget? (4 posts)

  1. Kevin Kwok
    Member
    Posted 4 years ago #

    Hello, I am trying to manually input the code for the Archives widget within my SIDEBAR.php but i cannot find the code anywhere.

  2. Kevin Kwok
    Member
    Posted 4 years ago #

    ok i found out this code:

    <ul>
    <?php wp_get_archives('type=monthly'); ?>
    </ul>

    but it doesnt show the number of posts each month has, any ideas?

  3. jimisaacs
    Member
    Posted 4 years ago #

    @queesy

    You are on the right track here. You are just looking for more arguments.

    The following is pulled directly from the file "wp-includes/default-widgets.php" line 234.

    <?php wp_get_archives(apply_filters('widget_archives_dropdown_args', array('type' => 'monthly', 'format' => 'option', 'show_post_count' => $c))); ?>

    $c is simply a boolean set previously as a widget setting.

  4. ClaytonJames
    Member
    Posted 4 years ago #

    but it doesnt show the number of posts each month has, any ideas?

    Try adding this and see if it looks ok to you : &show_post_count=1

    <?php wp_get_archives('type=monthly&show_post_count=1'); ?>

    Reference: http://codex.wordpress.org/Template_Tags/wp_get_archives

Topic Closed

This topic has been closed to new replies.

About this Topic