Converting Archives to a Drop Down Correctly
-
Hey Guys,
I’m trying to convert my list of archived months to a dropdown. I’ve gotten it to work, however not 100% correctly. Can someone please explain this function to me:
function wp_widget_archives($args) { extract($args); $options = get_option('widget_archives'); $c = $options['count'] ? '1' : '0'; $d = $options['dropdown'] ? '1' : '0'; $title = empty($options['title']) ? __('Archives') : $options['title']; echo $before_widget; echo $before_title . $title . $after_title; if($d) { ?> <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo attribute_escape(__('Select Month')); ?></option> <?php wp_get_archives("type=monthly&format=option&show_post_count=$c"); ?> </select> <?php } else { ?> <ul> <?php wp_get_archives("type=monthly&show_post_count=$c"); ?> </ul> <?php } echo $after_widget; }All I’ve done is basically replace:
<?php //wp_get_archives('type=monthly&limit=12&show_post_count=1'); ?>with:
<?php wp_widget_archives('type=monthly&limit=12&show_post_count=1'); ?>But that alone isn’t getting it done. Any suggestions would be appreciated.
Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Converting Archives to a Drop Down Correctly’ is closed to new replies.