MoonPhase Plugin for WordPress
MoonPhase Plugin
Dead simple plugin for WordPress. Just copy the plugin to your plugin directory, copy the “moonimg” directory and all images therein to your “wp-includes/images/”directory, go to the Plugin Management page, turn the plugin on and add the tags to your templates.
To add the moonphase to all your posts, add < ?php moonphase($post->ID) ?>
to the Main template somewhere under the “post” section. To add the current moonphase to the sidebar, add < ?php get_moonphase(); ?>
to the appropriate section of your sidebar template. Yes, it really is that easy.
The plugin was tested with both WordPress versions through 3.0, but I make no promises. Hey, it’s free, so what do you want from me? If, you find a bug, however, and can identify it, like Howard Edin from howardedin.com did, let me know and I’ll do my best to correct it.
Enjoy it and good luck!
UPDATE: So, after letting this languish for an embarrassingly long time, I updated some code. There have been pretty significant changes to some of the calls to WordPress that I’d used to make this all run and I’d made at least one logic error that kicked out all kinds of errors and made at least one part of the plugin not work quite the way it was intended. I’m afraid that at least one person complained, in an indirect and passive-agressive way, about that and, I believe, incorrectly thought it was a time zone error. In any case, that’s been corrected, too.
I apologize for taking so long to get to this, but, well, I’ve been busy. You know, out in the “server room with the big, blue ceiling”? Also, with dating. I may be a hardcore network geek, but dating and nookie always take precedence over correcting personal code that generates no money.
In any case, it’s been updated. I’m going to enable comments again on this page so you can let me know if you find any errors, but this should now work with WordPress all the way through version 3.5, under which is has been tested. (Well, at least it was tested against the 3.5 beta code, but it should be close enough.)
Enjoy!
Download the Moon Phase Plugin.
If you liked this plugin and would like to contribute to the author’s financial and mental state, feel free to make a donation!
Are you still working on this plugin?
I get this error when I activate it 🙁
I am running WordPress 1.5.1.2
What am I doing wrong?
Help me please!
Comment by toolvicarious — 6/12/2006 @ 8:46 am
Nope, should be done and working. As I mentioned in the post, I tested it under 1.5 and 2.x and it worked okay for both, but I can’t promise anything. If we get this resolved via e-mail, I’ll post the results here.
Comment by the Network Geek — 6/12/2006 @ 8:52 am
Hello – even after all this time this is still a cool plugin. I’m using it on a Habari install at the linked addy, as well as on a couple of wp installs. The wp installs show the correct phase (today, waxing crescent). The Habari install (out of which I ripped the wp-specific stuff) is showing waning crescent from about a week ago, and I can’t figure out how to get it to update.
Now, Habari is seriously 0.1 alpha right now, the plugin system isn’t actually working yet. I’ve just got things more or less “hard-coded” so the functions can find the relevant php file and images.
Any thoughts? Thanks!
Comment by vkaryl — 1/20/2007 @ 6:25 pm
I live in Houston Texas too and happen to be a certified Novell Administrator but I’m not at the engineer level yet. I am trying to install this plugin on my wordpress blog but for some reason it isn’t recognizing it. I have the updated WP version from the company but I am running on a Windows server. I wonder if that has anything to do with it? I will sleep on it and try again I guess.
Comment by Houston Texas — 12/12/2007 @ 5:03 pm
Wow, that’s strange Mr. Texas, your IP address says you’re in New Jersey and you link to a site that sells electricity. Stranger still that you didn’t respond to my e-mail to you.
Look, folks, I’m far from perfect, but if you’re a comment/link spammer, even a clever one, I’m going to figure it out and mess with your link so you get no real benefit from it. I have the time and the motivation. Honest.
Comment by the Network Geek — 12/13/2007 @ 5:29 pm
This is a great peice of code my friend. I am adapting it to a site I am working on where all we really need is the current moon phase. I tihnk there is a bit of a prob with the get time function but that code well be code specific.
Many thanks for this and feel free to conect me if you’d like a peek.
🙂
Comment by Majes — 1/6/2008 @ 7:08 am
It might be your adaptation of the code. Remember, this is a plugin for WordPress, so it’s designed to get a time & date from the current post for one function. Though, the other function grabs it from the server and that should be working fine. At least, it works everywhere I’ve tested it.
Probably the best thing to do is create your own function that makes a call to the moon phase calculation function. That’s basically what I did in the first place.
Comment by the Network Geek — 1/6/2008 @ 7:52 am
I noticed you think I am a link spammer but not so. Your response must have gone to my junk mail folder. I am a Certified Admin and have the stupid pin and certificate they give you to go with it. I have a blog called Spiritfolk.com which is where I was trying to install the plugin. I am not sure why my ip address says new jersey as I live in Texas. I put in my link as there is nothing wrong with that if your not a spammer which I am not. I would still like help installing to my blog if you can help. I have entered an alternate email if you could send me a possible solution.
Comment by Donny — 1/9/2008 @ 12:50 pm
Sorry, the combination of no response and a suspicious link and a suspicious IP led me to an incorrect conclusion. Also, I looked at the link you left and it had no reference to my plugin.
What’s the error you’re getting?
Yes, it’s possible that it has something to do with the server config, but I need more information to try to help.
Comment by the Network Geek — 1/9/2008 @ 10:05 pm
I have the full collection of old Sky & Telescope BASIC Computing codes for a raft of brief astronomy algorithms. Great idea-material for plugins.
NASA will be releasing new coverage of Mercury soon…
Thanks! Ted Clayton
Comment by Ted Clayton — 1/15/2008 @ 4:52 pm
Good post. You make some great points that most people do not fully understand.
“Dead simple plugin for WordPress. Just copy the plugin to your plugin directory, copy the “moonimg” directory and all images therein to your “wp-includes/images/”directory, go to the Plugin Management page, turn the plugin on and add the tags to your templates.”
I like how you explained that. Very helpful. Thanks.
Comment by chiz — 2/21/2008 @ 9:09 am
Okay, chiz, you seemed legit enough to let your comment through, but I’m not sure what you meant by “great points that most people do not fully understand.” Unless, of course, you’re referencing something off-site.
And, if anyone follows that link above, or any link on my site, that turns out to be a spam link I missed, please tell me so I can do something about it. Thanks!
Comment by the Network Geek — 2/21/2008 @ 11:44 am
[…] damn Moon phase error being displayed on the right column here. The original code I used is from Diary of a Network Geek who really just wrapped the code from another site. Originally I modified this to show percent […]
Pingback by Howards Astronomical Adventures » Blog Archive » Updates and Fixes — 7/24/2010 @ 10:11 pm
Hey, Howard, I updated the code, so I’m pretty sure the problem will be solved now. Also, I did a little more than just “wrap the code from another site”, which I suspect you know, but are only saying because you were frustrated with the error. Next time, please, just drop me a note and we’ll see about getting it worked out, okay?
Comment by the Network Geek — 9/28/2012 @ 11:37 am