→  Mondphasen für Wordpress

The Moon for Wordpress

Dienstag, 22. Dezember 2009 von hc greier

→ There are scripts like this, already?

Yes, indeed…

For the last few months I was looking for a Wordpress plugin or widget that shows the Moon’s phases. There are some plugins, but beeing an amateur astronomer they didn’t really satisfy my visions. Not to call someone others work bad, no way! Somehow the existing moonphase scripts are not that exact as they could be. But, again, maybe my point of view is something different…

OK, as you can see in the sidebar there goes my solution for the problem. It’s a widget written in Flash, which is 160 pixels squared. It shows the Moon’s current phase and has some more features. You can easily set the layout to English or German in the widget’s parameter backend. However, in the english version the date has the format Month/Day/Year, but the time format is still in 24 hours mode, not 01-12 am/pm. In astronomical calculations, there is no am/pm “concept”. The time from your system is converted into UT (Universal Time) and the calculations are made due to this instant.

You can modify nearly every visual parameter of the basic layout of the widget in the backend, as there are:

Current parameters availiable
  • Background color
  • Background alpha value
  • Font color (including all visible elements except the Moon)
  • The color of the dark part of the Moon’s surface
  • The alpha value of the dark part
  • Frame color
  • Frame alpha value

Unfortuantely, the size of the widget isn’t adjustable, because the widget uses pixel fonts for all text displays. But hopefully your sidebar isn’t that small, is it?  ;)

Some color examples (screenshot shows both German and English version of the widget)

Layout screenshots

→ Features

Standard screen on loading:
  • Picture of the current phase of the Moon
  • Calculations are given in system time of your machine, daylight saving time is taken into account.
  • Shows the current illumination in %, maximal error should be ±0.18 %
  • Shows the time span to the upcoming New Moon and upcoming Full Moon in days/hours/minutes (e.g. 12d 17h 22m), nearest event is printed first.
  • A click on the zodiac sign draws the zodiac over the graphics, showing the “astrological” position with the ecliptic longitude value of the Moon (please don’t confuse the astrological-zodiacal position of the Moon with the astronomical constellation!).
  • Text description of the current phase

Standard screen

Click on the “Continue”-Button
  • Text output: Age of the Moon in days/hours/minutes (= time span from the last New Moon up to the current Moon)
  • Text output: Length of the current lunation in days/hours/minutes (= time span from the last New Moon up to next New Moon)
  • Shows the current lunation in an overview, starting from the last New Moon to the upcoming New Moon. The First Quarter/Full Moon/Last Quarter phases are drawn within, keeping the real distances as their events occur on the timeline.
  • Progress bar of the current lunation, showing how much of the Moon’s cycle has completed
  • Date output for all phases to occur, time is given in 24 hours mode.

Progress of the lunation

Setting the date and time
  • Setting another date is easily done by clicking the desired part and dragging the mouse to the left or right. The date range is from 1900 to 2100.

  • You can also set the time in this way. The hour mode is in 24 hours per day.

  • Click on the “Date” in the upper left corner to reset the date/time to your system time.

Setting date and time

The zodiac
  • Clicking on the zodiac sign (here shown as “Leo”, as the Moon stood in that sign when making the screenshot) brings up a graphic drawn over the Moon’s graphic. It shows the zodiacal position of the Moon, given in degrees and acrminutes inside the current sign. On the given screenshot you can see 8°33.9′, meaning the Moon has travelled 8 degrees and 33.9 arcminutes since entering the sign of Leo. It also shows if the Moon is at Long or Short Ascending. The Moon is long ascending while travelling the signs Capricornus to Gemini (included), and short ascending while Cancer to Sagittarius (included). Be aware that the long and short ascending is vice versa on the southern hemisphere of the earth.

Zodiac and ecliptic longitude

→ For the interested ones…

The phases of the Moon are exact instants of time. It looks like that the Moon is “full” over serveral days, because it is very hard to see a very small dark sickle with the naked eye. In fact, all these phases are points of time. These times are calculated in an astronomical way here, not just setting up equal time spans by “guessing” the times from the last New Moon upwards. This will be wrong after a short period of time.

Calculating the phases of the Moon is not trivial. One cound take the date and time of the last New Moon. Knowing that an average lunation is about 29.530556 days long, one divides this period by 4, so he gets the dates and times for the upcoming phases. But, unfortuately,  nature isn’t that simple. Calculating the phases in such way could be one day in error sometimes! The Moon’s orbit isn’t a circle, but an ellipse, so the Moon travels fast when he is near to the Earth and more slowly when he is far away. Moreover, the orbit of the Moon is tilted to the orbit of the Earth by more than 5 degrees. Therefore, the length of the lunation can differ more than 7 hours from the average lunation, which is 29 days 12 hours and 44 minutes long.

Depending on the accuracy one wishes to obtain, calculations become complex very quickly. Is has to be said that the calculations for this widget are not too complex, there is no need to calculate for “seconds of time” accuracy. Most calculations are based on the algorithms of Jean Meeus’ book “Astronomical Algoritms“. The accurracy within the time span 1900-2100 lies at 1 or 2 minutes in error. Too much accuracy will bring up performance problems.

Calculating the zodiacal position means to get the current position of the Moon on the ecliptic, or true ecliptical coordinates. The zodical signs are divided in equal parts of 30 degrees, starting at Aries (0°-30°), Taurus (30°-60°), Gemini (60°-90°), and so on…. So when one gets a true ecliptical longitude of 128.565°, this means that the Moon is in “Leo” (120°-150°), and since the entering of that sign he travelled 8.565° or 8°33.9′.

Last not least: The times of the phases of the Moon do not depend on where the observer is located. The instants are calculated in Universal Time (UT), the timezone of Greenwich, London. The output times are then given, of course, in the time according to the UT timezone-offset of your machine. It is not crucial if you are sitting in Los Angeles or Berlin.
Example: Full Moon occurs on September 23, 2010, 09:18 UT. That is 10:18 MEZ (Middle european timezone = UT+1h) in Berlin, or 11:18 with taking the daylight saving time into account. The same instant occurs on 01:18  in Los Angeles (UT-8h, Pazific Standard Time =02:18 Pazific Daylight Time)

→ Languages

Unfortunately, at the moment there are only English and German availiable. You can set the language in the widget’s backend.

→ Download

15.2.2010: New versiopn upcoming. Some more features, like calculation of rising/setting, are planned.
I’m currently testing the widget, upload soon. I am looking forward to build a “plugin only” version, too (no widget).

You can download the current version Wordpress Moonphase widget here:

moonphase_parallax_at.zip

The widget was tested on Wordpress v2.8 and v2.9. it should run on Wordpress versions from v2.6 upwards, but there are no guarantees. Please report troubles if you discover. Thanks!

And one more thing: No registration, no costs, no code twiddle diddle. Just install, set your layout, enjoy.

→ Installation

  1. Unpack the *.zip file and extract the “moonphase_parallax_at” folder. The folder contains two files, the .php and the .swf file.
  2. Using an FTP program, upload the full “moonphase_parallax_at” folder to your WordPress plugins directory (Example: /wp-content/plugins).
    Attention: Please NEVER rename the folder name inside your plugins directory. The name has to be “moonphase_parallax_at” (no other folder name is accepted, to work correctly and to avoid conflicts with other plugins. Also please DO NOT rename the swf-file, which name is parallax_at_mondphase.swf.
  3. Go to Plugins > Installed, activate the plugin.
  4. Go to Appearance > Widgets, add the widget to a sidebar, set your default options.
  5. Save, ready go!

Have fun!


Mondphase

Meta

 

WP-Design: Vlad -- Powered by WordPress -- XHTML 1.0