• What I desire that I don’t seem to be able to find anywhere is to create an archives page that lists every post on the blog. I desire them to be organized by month and all displayed when one lands on the page. Meaning, no one needs to click on a month to expand to see the posts from that month.

    February 2023
    21 post title
    20 post title
    19 post title

    January 2023
    31 post title
    30 post title
    etc.

    I used to use a plugin called Clean Archives Reloaded that produced an archives page like this. It is no longer supported.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    A normal blog page archive will list all posts, except they are not organized under monthly headings. And each listing may include more information than you really want. So the query is returning the posts you want, and they are already in reverse chronological order. You only need to alter how the template outputs the posts list. The template is normally index.php, but it’s feasible to force a different template through “template_include” filter.

    Make a backup of your theme’s index.php so you can easily revert if need be. Within the loop, remove all code that outputs anything you don’t want, such as post meta, excerpt, categories, tags, etc. You probably just want a linked title.

    Modify the loop code to conditionally output a monthly heading. Get the current month and year from the current post. Save these in variables and output the heading. The variables are to be used to indicate what the last header output was. As long as the current post’s month and year match, only output the title, not any header. As soon as there is not a match, output a new header and update the variables.

    If this is done right, the blog listing can be paginated and the headings will appear correctly even if the page breaks in the middle of a month’s listing. There will then be a repeated heading at the top of the next page for the rest of the month’s listings.

    You can get the query to output all posts on a single page, but this can become cumbersome when there are a huge number of posts. If you really want a lot of posts on a single page, consider an infinite scroll or load more implementation that loads another batch of posts when the scroll gets close to the bottom.

    Thread Starter RDOwens

    (@rdowens)

    Thank you. I am working on this. Haven’t figured it out just yet. I thank you for pointing me in the right direction.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Customizing Archives’ is closed to new replies.