The article archive is modified to a drop-down list

 Article archiving - drop-down list modification The blog has been open for more than a year, and one of the sidebars is output according to the month. As time goes on, it becomes long and smelly. Are you trying to make it shorter? My first idea is the drop-down list OK, If you have an idea, the next step is to realize it. Anyway, if there is a problem, it is Google I believe it won't let me down. As expected, I found clues

The next step is testing. It will be ready soon. You don't need to modify many places, but just cover the code listed in the original list. Let's share the code below

On the sidebar, find the "article archive" (of course, according to the actual situation, different people have different names)

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

Replace with the following code:

 <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><? php echo esc_attr(__('Select Month')); ?></ option> <? php wp_get_archives(apply_filters('widget_archives_dropdown_args',  array('type'=> 'monthly', 'format'=> 'option','show_post_count'=> $c))); ?> </select>

OK. It's that simple

Appreciation

see wp php code Related articles for

Please specify that the original article of this website is reproduced from To be kicked , Link: https://www.itlu.net/articles/1304.html

Comment list (10)

  1. After a year of perseverance, basically I don't think anyone will go to the date archive --

  2. This option is available when setting the wp widget

  3. I put this stinky and long archive on a separate page

  4. @Rivers
    People, of course, don't usually go to see it. It's for search engines

    @ooaixt
    I don't use gadgets to set the sidebar. I write it directly into the code

    @Wange
    I also have a separate page

  5. My blog theme also has this function

  6. @Firm
    Some topics have their own themes Inove doesn't have

  7. @itlobo
    But I don't think it's very useful. Nobody goes back to order that

  8. @Firm
    That's for sure. Hehe. I haven't even seen it myself, let alone others

  9. Indeed, the list will be very bloated after a long blog. I think if my blog is long in the future, I will simply throw away the archived list.

  10. You have to use this for a long time, or it will be too long

    I sincerely wish you a happy new year and a happy family!
    Peace, good luck!

Add a comment

Hello! #Please fill in the information# determine

Reward the blogger for drinking water
 LOADING