• on my wordpress site i have a news section and i have news which is over 300 posts long,

    i owuld like to add a dropdown to the top of my archive listing so the user can select a month and see the posts only from that month.

    Im sure this is possible but not sure how.

    any help would be great. IE the code to paste into my archieve.php page

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Thread Starter kitcorsa

    (@kitcorsa)

    thanks i’ve tried these but they dont seem to work. i tried the

    <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( 'type=monthly&format=option&show_post_count=1' ); ?>
    </select>

    [Please post code snippets between backticks or use the code button.]

    code and this displays a list of all the months and post numbers of the posts but when i go to the month it takes me to a link https://www.mysite.co/11/2011 and i get 404 page not found instead of a list of all the posts from november

    any help?

    Moderator keesiemeijer

    (@keesiemeijer)

    If I use the code you provided on my testsite it works correctly and has this url structure: https://testsite.dev/2011/08/
    try:
    – deactivating all plugins to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    Please provide a link to the page in question.

    Thread Starter kitcorsa

    (@kitcorsa)

    i totally deactivated all my plugins and still didn’t work ??

    checked my permalink setting and i cant see a problem, its set to customom of /%day%/%monthnum%/%year%/%postname%/ but can’t see that being a problem.

    im pasting that code into the archive.php file in the pace i would like it to appear.

    i’ll pm you the link

    Thread Starter kitcorsa

    (@kitcorsa)

    oh there is no PM option on here

    here is the link to the news section of my site with the drop down at the top.

    https://www.theeyemagazine.co.uk/category/local-news/

    also is there a way to make a archive file just for this catogary?

    Thread Starter kitcorsa

    (@kitcorsa)

    if i go to a page like

    https://www.theeyemagazine.co.uk/25/11/2011/

    this shows all the posts for that day but if i remove the 25/ its says page not displayed so its not showing all the posts from that month…

    something missing somewhere in my archieve file i guess

    Thread Starter kitcorsa

    (@kitcorsa)

    i have figgure out that if i put a 0 infront of the listing it s will then display the whole month… ie 0/11/2011 will display all of november

    Thread Starter kitcorsa

    (@kitcorsa)

    not sure how i can get the 0 to be added to the link url when using the dropdown… any help

    Thread Starter kitcorsa

    (@kitcorsa)

    even the arcieve widget for the sidebar doesn’t work eithger, this take me to the same place as before and the 404 error page

    Thread Starter kitcorsa

    (@kitcorsa)

    i have now found it has to do with the custom permalinks, i have change my links back to a default option of day and name and the montly filter is working, this is a shame as its a uk magazine site and would of been nice to have my urls is UK order of d/m/y instead of the /%year%/%monthnum%/%day%/%postname%/ wordpress filter works on.

    any ideas?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Filter archive by months, date, year etc’ is closed to new replies.