Hebrew Date Plugin

WordPress Mug

Update: The WordPress Hebrew Date Plugin Has a New Home!

The Hebrew date plugin is a simple plugin that displays Hebrew dates alongside the current Gregorian dates. The default format currently used is the Gregorian and Hebrew format:

June 24th, 2005 – י"ז סיון תשס"ה

You can optionally output the Hebrew date in the Latin charset (English) to display:

June 24th, 2005 – 17 Sivan 5765

To change this setting, change the line

$jewishDateStyle = "HEBREW_AND_GREGORIAN";

to

$jewishDateStyle = "JEWISH_AND_GREGORIAN";

(Both are in the code but one line is //commented out.)

An other option is the spelling of the Jewish month names when using the Latin charset. This can either use the default Ashkenazi pronunciation of Cheshvan & Teves, or the Sefardic pronunciation of Heshvan and Tevet.
To change to the Sefardic spelling, change:

$useAshkenaziSpelling = true;

to

$useAshkenaziSpelling = false;

Version 0.9 is now available for your testing.
This plugin will output Hebrew and Gregorian dates in WordPress. This has not been tested on WP 1.2 and will probably not work in anything less than 1.5. To activate, unzip, copy to the plugin directory and enable. That’s it. No theme changes should be required.
The code is a drop rough and relies on the detection of a ‘:’ in the Date String to determine that it is a time and not date. This works well with the default WordPress 1.5 theme (Kubrick). Other themes that use alternate date formatting might not work perfectly with this plugin (but probably will work fine).

Related Posts

44 thoughts on “Hebrew Date Plugin”

  1. over all a great plugin, however you seem to have left out a bit of code that deals with leap years. All my posts from adar I are messed up as a result. To see an example of the error message check out:
    February Posts
    I’d appreciate any updates to this that you are able to do. Like I said I otherwise love the plug-in.

  2. I’m new to WordPress and your Hebrew Date Plugin (ver 0.9) and I’m having some trouble. When I activate the plugin it errors out on the site at line 70. It says:

    Fatal error: Call to undefined function: gregoriantojd() in /sites/ariellovesdana/html/wordpress/wp-content/plugins/hebrewdate.php on line 70

    Am I missing something? Any help would be greatly appreciated. Thanks!

  3. Shalom KosherJava:

    I’ve been using your Hebrew date plugin ever since I started using WordPress, and I really like it.
    I’m wondering how easy it would be to add the capability of displaying occasions for the given date, (for instance, any entries displaying 1 Heshvan also displaying Rosh Hodesh, or the days of the week being displayed as “First Day of Parshat … “. Any help you can provide would be appreciated.
    Thanks in advance, and g’mar chatimah tovah.

  4. I’m using WP 1.5 and yes, Hebrew date seems to work fine on the default theme. On the theme that I’m using, Mike Little’s Journalized-blue, I get the Hebrew date in comments, but nowhere else.

    Any idea how to edit the theme or the plugin to get them working together?

  5. I asked Mike Little and here’s what he said:

    The plugin only wraps calls to the_time() (and get_comment_date()) and adds the Hebrew date to the end. My theme uses the_date().

    To fix it with my theme, you need to replace the call to the_date() with a call to the_time().

    In index.php around line 14 replace

    `’,”);?>`

    with

    Then in page.php at the end of line 16 replace

    ` @ on .`

    with

    `on .`

  6. Just wanted to drop by and point out that Mike Little graciously answered this for me. Here’s what he wrote (sorry about my first try; the code didn’t show up):

    The plugin only wraps calls to the_time() (and get_comment_date()) and adds the Hebrew date to the end. My theme uses the_date().

    To fix it with my theme, you need to replace the call to the_date() with a call to the_time().

    In index.php around line 14 replace

    ‘,”);?>

    with

    Then in page.php at the end of line 16 replace

    @ on .

    with

    on .

  7. Your posting was the first I ever heared of Textpattern, though I had no trouble finding it at https://textpattern.com/ . The code is very straight forward and built from code that I wrote for PhpGedView. Support for the Jewish calendar is built into PHP so writing the code was not complex. Turning the code into a WordPress plugin was simply a matter of using the WordPress Plugin Hooks and a few small tweaks. You need to find out how to use similar hooks with Textpattern (assuming that they exist).

  8. Hy everybody, I’m an italian webdesigner, so I start my help request apologizing for my broken english 🙂

    Thanx to Kosherjava who give us the plugin. I’m triing to use it for the upcoming site ( http://www.levchadash.info) of a liberal Sinagogue in Milan, Italy.

    I installed the plugin, but it doesn’t work.

    It prints a fake date: “1 January 1970 – 23 Tevet, 5730” even the time flows 🙂

    I use wordpress 2.01, italian version.
    I’m not very skilled in PHP.

    Maybe the problems are both version and localization of WP?

    I home someone can help me.

    Thank you in advance,
    Shabbat Shalom

  9. Lev,
    It is likely the localized version of the plugin. I have not tested it on 2.0, but I do know that others have had no problem with it running on 2.0. If you look at the source code of the plugin on line 44, you will see an array of month names with a comment after it about localization issues. Try replacing that line with Italian, and let me know if it solves your issue. There have also been some theme specific bugs, so I am not sure that this will solve your issue. I have a feeling that changing the array in line 44 might not solve your issue, since there a lot of assumptions in the code regarding date formats that might not be applicable for your local.

  10. Shalom,

    I installed hebrew-data-plugin (which seems awesome and very much needed, by the way is there a hebrew calendar wordpress plugin?) and activated it in wordpress 2.1, but I might by a little bit “a wordpress newbie”, coz’ I haven’t a clue how I make it work, so that I can see it. I put $jewishDateStyle to some where, but where in my theme’s code?

  11. Hi,
    I am in the process of renovating a website and would need to get an advice on two point :
    – how to keep skip gregorian (because day, month and year already appeared, in French on my wordpress theme) ?
    – how to make appear at the same time hebrew date format and jewhish date format in latin char ?

    I think, having a look at the website will make my issue more understanbable.
    Thanks a lot for your help and for this great plugin !

  12. Sorry for the delay in answering. I am not sure what you mean by

    "we would like to include both the English and Hebrew date in Gregorian format"

    , but here is some information that you can use. Your site seems to use Joomla. I know very little about Joomla, and my plugin (no longer supported here) was designed to work with WordPress. A quick Google search turned up the Hebrew Date Joomla plugin . You can also (assuming that you have PHP 5), use the following line of PHP to add a Hebrew date to your site.

    echo mb_convert_encoding( jdtojewish( unixtojd(), true, CAL_JEWISH_ADD_GERESHAYIM), "UTF-8", "ISO-8859-8");

Leave a Reply

Your email address will not be published. Required fields are marked *