Skip to main content
deleted 1 character in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57

For generating the nav, this should work.

{% set allEntriesByWeek = allEntries|group("postDate|date('Y-W')") %}
{% for week, entry in allEntriesByWeek %}
    <li><a href="events/{{ week|replace('-','/') }}">{{ week }}</a></li>
{% endfor %}

For grabbing entries (using the 'week' and 'year' variables passed via the route).

{% set startDate = now.setISODate(year, week) %}
{% set endDate = startDate|date_modify("+6"+7 days") %}
{% set entries = craft.entries.section('events').postDate('and', '>= ' ~ startDate, '<='< ' ~ endDate ) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

For pagination.

<a href="events/{{ startDate|date_modify('+7 days')|date('Y/W') }}">Next Week</a>
<a href="events/{{ startDate|date_modify('-7 days')|date('Y/W') }}">Previous Week</a>

For generating the nav, this should work.

{% set allEntriesByWeek = allEntries|group("postDate|date('Y-W')") %}
{% for week, entry in allEntriesByWeek %}
    <li><a href="events/{{ week|replace('-','/') }}">{{ week }}</a></li>
{% endfor %}

For grabbing entries (using the 'week' and 'year' variables passed via the route).

{% set startDate = now.setISODate(year, week) %}
{% set endDate = startDate|date_modify("+6 days") %}
{% set entries = craft.entries.section('events').postDate('and', '>= ' ~ startDate, '<= ' ~ endDate ) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

For pagination.

<a href="events/{{ startDate|date_modify('+7 days')|date('Y/W') }}">Next Week</a>
<a href="events/{{ startDate|date_modify('-7 days')|date('Y/W') }}">Previous Week</a>

For generating the nav, this should work.

{% set allEntriesByWeek = allEntries|group("postDate|date('Y-W')") %}
{% for week, entry in allEntriesByWeek %}
    <li><a href="events/{{ week|replace('-','/') }}">{{ week }}</a></li>
{% endfor %}

For grabbing entries (using the 'week' and 'year' variables passed via the route).

{% set startDate = now.setISODate(year, week) %}
{% set endDate = startDate|date_modify("+7 days") %}
{% set entries = craft.entries.section('events').postDate('and', '>= ' ~ startDate, '< ' ~ endDate ) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

For pagination.

<a href="events/{{ startDate|date_modify('+7 days')|date('Y/W') }}">Next Week</a>
<a href="events/{{ startDate|date_modify('-7 days')|date('Y/W') }}">Previous Week</a>
added 1 character in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57

For generating the nav, this should work.

{% set allEntriesByWeek = allEntries|group("postDate|date('Y-W')") %}
{% for week, entry in allEntriesByWeek %}
    <li><a href="events/{{ week|replace('-','/') }}">{{ week }}</a></li>
{% endfor %}

For grabbing entries (using the 'week' and 'year' variables passed via the route).

{% set startDate = now.setISODate(year, week) %}
{% set endDate = startDate|date_modify("+6 days") %}
{% set entries = craft.entries.section('events').postDate('and', '>'>= ' ~ startDate, '<= ' ~ endDate ) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

For pagination.

<a href="events/{{ startDate|date_modify('+7 days')|date('Y/W') }}">Next Week</a>
<a href="events/{{ startDate|date_modify('-7 days')|date('Y/W') }}">Previous Week</a>

For generating the nav, this should work.

{% set allEntriesByWeek = allEntries|group("postDate|date('Y-W')") %}
{% for week, entry in allEntriesByWeek %}
    <li><a href="events/{{ week|replace('-','/') }}">{{ week }}</a></li>
{% endfor %}

For grabbing entries (using the 'week' and 'year' variables passed via the route).

{% set startDate = now.setISODate(year, week) %}
{% set endDate = startDate|date_modify("+6 days") %}
{% set entries = craft.entries.section('events').postDate('and', '> ' ~ startDate, '<= ' ~ endDate ) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

For pagination.

<a href="events/{{ startDate|date_modify('+7 days')|date('Y/W') }}">Next Week</a>
<a href="events/{{ startDate|date_modify('-7 days')|date('Y/W') }}">Previous Week</a>

For generating the nav, this should work.

{% set allEntriesByWeek = allEntries|group("postDate|date('Y-W')") %}
{% for week, entry in allEntriesByWeek %}
    <li><a href="events/{{ week|replace('-','/') }}">{{ week }}</a></li>
{% endfor %}

For grabbing entries (using the 'week' and 'year' variables passed via the route).

{% set startDate = now.setISODate(year, week) %}
{% set endDate = startDate|date_modify("+6 days") %}
{% set entries = craft.entries.section('events').postDate('and', '>= ' ~ startDate, '<= ' ~ endDate ) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

For pagination.

<a href="events/{{ startDate|date_modify('+7 days')|date('Y/W') }}">Next Week</a>
<a href="events/{{ startDate|date_modify('-7 days')|date('Y/W') }}">Previous Week</a>
added 30 characters in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57

For generating the nav, this should work.

{% set allEntriesByWeek = allEntries|group("postDate|date('Y-W')") %}
{% for week, entry in allEntriesByWeek %}
    <li><a href="events/{{ week|replace('-','/') }}">{{ week }}</a></li>
{% endfor %}

For grabbing entries (using the 'week' and 'year' variables passed via the route).

{% set startDate = date()now.setISODate(year, week) %}
{% set endDate = startDate|date_modify("+6 days") %}
{% set entries = craft.entries.section('events').postDate('and', '> ' ~ startDate|date('m-d-Y')startDate, '<= ' ~ endDate|date('m-d-Y')endDate ) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

For pagination.

<a href="events/{{ startDate|date_modify('+7 days')|date('Y/W') }}">Next Week</a>
<a href="events/{{ startDate|date_modify('-7 days')|date('Y/W') }}">Previous Week</a>

For generating the nav, this should work.

{% set allEntriesByWeek = allEntries|group("postDate|date('Y-W')") %}
{% for week, entry in allEntriesByWeek %}
    <li><a href="events/{{ week|replace('-','/') }}">{{ week }}</a></li>
{% endfor %}

For grabbing entries.

{% set startDate = date().setISODate(year, week) %}
{% set endDate = startDate|date_modify("+6 days") %}
{% set entries = craft.entries.section('events').postDate('and', '> ' ~ startDate|date('m-d-Y'), '<= ' ~ endDate|date('m-d-Y') ) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

For pagination.

<a href="events/{{ startDate|date_modify('+7 days')|date('Y/W') }}">Next Week</a>
<a href="events/{{ startDate|date_modify('-7 days')|date('Y/W') }}">Previous Week</a>

For generating the nav, this should work.

{% set allEntriesByWeek = allEntries|group("postDate|date('Y-W')") %}
{% for week, entry in allEntriesByWeek %}
    <li><a href="events/{{ week|replace('-','/') }}">{{ week }}</a></li>
{% endfor %}

For grabbing entries (using the 'week' and 'year' variables passed via the route).

{% set startDate = now.setISODate(year, week) %}
{% set endDate = startDate|date_modify("+6 days") %}
{% set entries = craft.entries.section('events').postDate('and', '> ' ~ startDate, '<= ' ~ endDate ) %}
{% for entry in entries %}
    {{ entry.title }}
{% endfor %}

For pagination.

<a href="events/{{ startDate|date_modify('+7 days')|date('Y/W') }}">Next Week</a>
<a href="events/{{ startDate|date_modify('-7 days')|date('Y/W') }}">Previous Week</a>
added 1 character in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57
Loading
added 1 character in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57
Loading
deleted 20 characters in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57
Loading
edited body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57
Loading
added 400 characters in body
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57
Loading
Source Link
Douglas McDonald
  • 13.5k
  • 25
  • 57
Loading