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.
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 these items in place.
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 which 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:22 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:24 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"] – 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!