• Resolved Brad West

    (@bradawest)


    I’d like to create a loop for my blog like the on on Alex Sexton’s site: https://alexsexton.com/blog/archives/

    I’ve added a custom page template but can’t get the date to display only once.

    Since my site is in a local development environment I’m unable to include a link.

    Alex’s Liquid logic looks like this:

    {% for post in site.posts reverse %}
    {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
    {% unless year == this_year %}
    {% assign year = this_year %}
    <h2>{{ year }}</h2>
    {% endunless %}
    <article>
    {% include archive_post.html %}
    </article>
    {% endfor %}

    Any ideas how to recreate this in WordPress logic?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Creating a Custom Blog Template’ is closed to new replies.