Use Cases & Examples (Part 2)

  • KPrevious lesson
  • FSearch lessons
  • EscClear search

Events & Conferences

Event Countdowns

WordCamp [year] is [daysuntil date="2026-09-20"] days away!
→ WordCamp 2026 is 214 days away!

[daysuntil date="2026-12-25"] days until Christmas [year]
→ 310 days until Christmas 2026

[daysuntil date="2026-12-31"] days left in [year]
→ 316 days left in 2026

Conference Pages

Join us at DevConf [year] — [month] [dt]-[nd], [year]
→ Join us at DevConf 2026 — February 18-19, 2026

Early bird pricing ends [nmonth] 1st. That's [daysuntil date="2026-03-01"] days from now.
→ Early bird pricing ends March 1st. That's 11 days from now.

Anniversary & Milestone Celebrations

Today marks [dayssince date="2015-04-10"] days since our first meetup!
→ Today marks 3967 days since our first meetup!

Celebrating [age date="2015-04-10"] years of community events
→ Celebrating 10 years of community events

New Year Countdown

[daysuntil date="2027-01-01"] days until [nyear]!
→ 316 days until 2027!

Personal Blogs & Portfolios

Blog Post Dates

Originally published: [datepublished]
Last updated: [datemodified]
→ Originally published: February 18, 2026
→ Last updated: February 18, 2026

Personal Milestones

I started blogging [age date="2008-09-01"] years ago.
→ I started blogging 17 years ago.

[dayssince date="2008-09-01"] days of writing. Still going.
→ 6379 days of writing. Still going.

I've been a WordPress developer for [age date="2009-01-01" format="ym"].
→ I've been a WordPress developer for 17 years, 1 month.

Portfolio Freshness

Portfolio last updated [monthyear]. [age date="2009-01-01"]+ years of work.
→ Portfolio last updated February 2026. 17+ years of work.

Birthday & Personal Age

I'm [age date="1990-05-15"] years old.
→ I'm 35 years old.

[age date="1990-05-15" ordinal="true"] birthday coming up in [daysuntil date="2026-05-15"] days!
→ 35th birthday coming up in 86 days!

Currently in my [age date="1990-05-15" rank="true"] year
→ Currently in my 35th year

Terms of Service

These Terms of Service were last updated on [date].
→ These Terms of Service were last updated on February 18, 2026.

Effective for the [year] calendar year.
→ Effective for the 2026 calendar year.

Privacy Policy

This Privacy Policy is effective as of [monthyear].
→ This Privacy Policy is effective as of February 2026.

Last reviewed: [month] [dt], [year]
→ Last reviewed: February 18, 2026
This cookie policy was last updated [date]. We review it quarterly.
→ This cookie policy was last updated February 18, 2026. We review it quarterly.

Email & Newsletter Content

Email Subject Lines (via SEO title field in newsletter plugins)

[month] [year] Newsletter: What's New This Month
→ February 2026 Newsletter: What's New This Month

Your [season] digest is here — [monthyear] edition
→ Your Winter digest is here — February 2026 edition

Newsletter Body Content

Happy [weekday]! Here's your weekly update for [month] [dt], [year].
→ Happy Tuesday! Here's your weekly update for February 18, 2026.

Developer & Technical Uses

PHP Templates

// In theme templates
echo do_shortcode( '[year]' );
echo do_shortcode( '[month] [year]' );
echo do_shortcode( '[age date="1990-05-15" format="ym"]' );

// Conditional logic
$days = (int) do_shortcode( '[daysuntil date="2026-12-25"]' );
if ( $days <= 30 ) {
    echo 'Christmas is coming!';
}

// Dynamic copyright in footer.php
echo do_shortcode( '© 2009-[year] My Company' );

ACF Fields

Enable shortcode processing on specific ACF field types:

Part two of the use cases covers events, countdowns, anniversaries, and age calculations: for conference timers, for company-history pages that never go stale, and season-aware content that flips hemisphere correctly.

// All text fields
add_filter( 'acf/format_value/type=text', 'do_shortcode' );

// Specific field by name
add_filter( 'acf/format_value/name=headline', 'do_shortcode' );

// WYSIWYG fields
add_filter( 'acf/format_value/type=wysiwyg', 'do_shortcode' );

Then use shortcodes in any ACF text field:

Best [year] Deals
→ Best 2026 Deals

REST API for Headless WordPress

# Fetch all dates
curl https://example.com/wp-json/dmyip/v1/dates

# Single date type
curl https://example.com/wp-json/dmyip/v1/date/year

# Age calculation
curl "https://example.com/wp-json/dmyip/v1/date/age?date=1990-05-15"

# Days until event
curl "https://example.com/wp-json/dmyip/v1/date/daysuntil?date=2026-12-25"

JavaScript / React / Next.js

const { year, month, season } = await fetch('/wp-json/dmyip/v1/dates').then(r => r.json());

document.title = `Best Tools of ${year.current} - ${month.current} Update`;

// Conditional rendering
const days = await fetch('/wp-json/dmyip/v1/date/daysuntil?date=2026-12-25')
  .then(r => r.json());
if (parseInt(days.value) < 30) {
  showChristmasBanner();
}

WP-CLI for Scripting

# Get values for shell variables
YEAR=$(wp dmyip shortcode year)
DAYS=$(wp dmyip shortcode daysuntil --date=2026-12-31)
echo "Days remaining in $YEAR: $DAYS"

# Verify after deployment
wp dmyip test && echo "All shortcodes working" || echo "FAILED"

# Export shortcode reference as JSON
wp dmyip list --format=json > shortcodes.json

# Use in CI/CD
wp dmyip test --url=https://staging.example.com

Block Bindings in Theme Templates (WP 6.5+)

<!-- Current year in a paragraph -->
<!-- wp:paragraph {
    "metadata": {
        "bindings": {
            "content": {
                "source": "dmyip/date",
                "args": {"type": "year"}
            }
        }
    }
} -->
<p></p>
<!-- /wp:paragraph -->

Multilingual Sites

All shortcodes use date_i18n() which respects the WordPress locale. Zero configuration.

[month] [year] on a German site → Februar 2026
[weekday] on a French site → mardi
[season] on a Spanish site → Invierno
[date] on a Japanese site → 2026年2月18日
[monthyear] on an Italian site → febbraio 2026

Creative Combinations

“How long since” social proof block

Founded [age date="2009-06-15"] years ago.
That's [dayssince date="2009-06-15"] days of shipping code.
[age date="2009-06-15" format="ym"] of building for the web.
© 2009-[year] Company Name. Proudly serving clients for [age date="2009-01-01"] years.
Updated [month] [year]. [daysuntil date="2027-01-01"] days until [nyear].

Year range for fiscal reports

FY[pyear]-[year] Annual Report
→ FY2025-2026 Annual Report

Q1 [year] Results (January - March)
→ Q1 2026 Results (January - March)

Multiple offsets for timeline content

Looking back: [year n=-5] → 2021
Today: [year] → 2026
Looking ahead: [year n=5] → 2031
A decade from now: [year n=10] → 2036

Full date with day name

Today is [weekday], [month] [dt], [year]
→ Today is Tuesday, February 18, 2026

Tomorrow is [wd], [nmonth] [nd]
→ Tomorrow is Tue, March 19

Countdown + age combo for launches

Product launched [age date="2023-06-01" format="ym"] ago.
That was [dayssince date="2023-06-01"] days ago.
Next major release in [daysuntil date="2026-06-01"] days.

Quick answers to common questions:

How do countdown shortcodes handle past dates?

counts down to the date and reports accordingly once passed, so pair event countdowns with content you’ll update after the event, or wrap them in copy that reads correctly both before and after.

Can I calculate ages and anniversaries automatically?

Yes: 18 renders the elapsed years, with ordinal support (18th) since 1.7.0. It’s how “serving readers for X years” lines on this site stay correct without an annual editing ritual.