DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • A Firewall for AI Agents: Enforce Authority at Every Tool Call
  • Dynamic Tool Selection: A Portable Pattern for Agents Drowning in Tool Schemas
  • Enterprise Architecture in the AI Era: Tools, Capabilities, and the Road to Autonomy
  • How I Built a SQL Diagnostic Tool That Works Without Touching Your Database

Trending

  • Architecting Trust: Agentic Microservice Testing Strategies in the Era of Non-Deterministic AI
  • What Actually Makes AI Infrastructure Agents More Reliable (It's Not More Agents)
  • Why I Don't Want an LLM Generating Java Business Logic
  • Improving Repeated Analytics Workloads With Databricks Disk Cache
  1. DZone
  2. Coding
  3. Tools
  4. Zmanim-WP: Getting Started

Zmanim-WP: Getting Started

This tutorial introduces the Zmanim-WP plugin, covering basic sunrise and sunset shortcodes and their options for dates, locations, and formatting.

By 
Leon Adato user avatar
Leon Adato
·
Sep. 14, 26 · Tutorial
Likes (0)
Comment
Save
Tweet
Share
82 Views

Join the DZone community and get the full member experience.

Join For Free

Getting Started With Getting Started

If you’ve been following this blog, you’ll know that I’ve been working on my Zmanim-WP plugin for WordPress for a while now.

If you haven’t, you can check out everything written so far using this link.

And while the docs will give you a high-level overview, I realized that some folks might want a more detailed set of instructions. That’s what this blog series is going to be about – showing off each aspect or feature of the plugin with details on how to use it.

In this blog, we’ll just take a look at a couple of the features that are both simple and, at the same time, also allow you to explore a lot of options that are common across the plugin.

Sunrise, Sunset

More than a catchy lyric from a popular 1963 Broadway musical, sunrise and sunset form the basis of almost every other time calculation. So it makes sense to start with those two commands. The most basic usage is the shortcode itself:

‘[zman_sunrise]‘
or
‘[zman_sunset]‘

When added to a page, post, widget, newsletter, etc., this will display the time of those events on the date it is viewed for the location you indicated on the main options page.

Sunrise, Sunset


Location, Location, Location

…this will display the time of those events on the date it is viewed for the location you indicated on the main options page.

Let’s break down some of the parts of that sentence:

“on the date it is viewed”

The Zmanim-WP plugin works in realtime. If you put ‘[zman_sunrise]‘ on a WordPress page and look at that page on a Monday, you’ll get sunrise for Monday. If you go back and look at it on Tuesday, you’ll get sunrise for that Tuesday.

At least by default. There are ways to be more specific, and we’ll get to that shortly.

“for the location you indicated on the main options page”

Before the Zmanim-WP plugin will work at all, you have to fill out the fields on the Main Options page. These include your location (the latitude and longitude) as well as the time zone. There are other options on that page, but for any time calculation to work, you need to have these items in place.

Zmanim WP Main Options


Shortcode Options

In addition to the shortcode itself, Zmanim-WP supports options that let you change everything from the display language to the date shown and beyond.

The parameters that are available across all (or at least most) Zmanim WP shortcodes are:

date

This lets you set a date other than “whatever date it is when I look at it. Valid options include:

  • today: This shows the zman for the current date (when the page/post is being viewed). Yes, it’s the default action, and you don’t actually NEED to include this. But I added it into the program for the sake of completeness.
  • tomorrow: This will show the time for the day after the current date.
  • sunday, monday, tuesday, etc.: This will give the time for the next upcoming weekday of that name. So if it’s Tuesday and you used [6:03 am] then you’ll get sunrise for the NEXT Monday, not the one that just passed.
  • (an actual date): Any reasonable date format (2023-01-20, Jan 20, 2023, 1/20/23, etc.) will show the time for that specific date.

Example: [6:00 am]
Example: [7:47 am]

offset

This lets you get a time plus or minus the number of minutes (including fractions – i.e. 10.5) you specify. This can be useful if, for example, weekday Mincha starts at 20 minutes before sunset each day.

Example: [zman_sunset offset=-10]
Example: [zman_sunset offset=20]
Example: [zman_sunset offset=+20]

dateformat

Sometimes you want the date to show DAY mm/dd (i.e., “Mon 3/15”). Sometimes you want it to show as yyyy-dd-mm (i.e. “2025-03-15”). Or you want the time to show as hh:mm:ss am/pm (i.e., “09:15:22 am”). The “dateformat” option lets you specify what the output should look like, using the standard PHP date/time formatting codes. Use this link to see all your options: https://www.php.net/manual/en/datetime.format.php and this tutorial for more information: https://www.tutorialrepublic.com/php-tutorial/php-date-and-time.php.

Example: [zman_sunrise dateformat="m/d/Y h:i:s a"]

Putting It All Together

When used in combination, these options allow a significant level of control.

  • [zman_sunset date="friday"]: This gives sunset for the upcoming Friday.
  • [zman_sunset offset=+45 date="saturday"]: This will give the time that is 45 minutes after sunset on the upcoming Saturday.
  • [zman_sunset offset=+72 dateformat="m/d/Y h:i:s a"]: This would give the time 72 minutes after sunset, in the format of month/day/year hour:minute:second am/pm.

We’ve Only Just Started Getting Started

Sunrise and Sunset are only the first two of a long list of shortcodes available in the Zmanim-WP plugin for WordPress. I’m going to continue to explore them in the coming weeks.

If you have questions about the plugin or anything I’ve shared, feel free to reach out in the comments and ask!

Tool

Published at DZone with permission of Leon Adato. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • A Firewall for AI Agents: Enforce Authority at Every Tool Call
  • Dynamic Tool Selection: A Portable Pattern for Agents Drowning in Tool Schemas
  • Enterprise Architecture in the AI Era: Tools, Capabilities, and the Road to Autonomy
  • How I Built a SQL Diagnostic Tool That Works Without Touching Your Database

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook