May 2007

Creating a (Better) Fake Post with a WordPress Plugin

I was looking to create a fake page in a WordPress plugin I’m working on in my (all too limited) spare time. It may seem a little silly to try to create a fake page with a plugin but this could be useful for any plugin that will display information to the readers of the blog (outside the admin panel), like statistics, contact pages or about pages. Luckily there is a handy tutorial for creating a fake posts. But although the plugin cleverly tricks WordPress into displaying a post created dynamically by the plugin itself, WordPress is clever enough to know something is wrong and sends a 404 error before sending the plugin-created content. Although many browsers will still display the page, this is a problem for any text-based browser or if you want the page to be indexed by search engines and (for me at least) just kind of grates to know my magnificent new plugin isn’t actually performing correctly. Anyway, this happens because WP->handle_404() called by WP->main() in classes.php checks how many posts were found which, in this case, is 0 since there is no real post for the requested URL. To get around this problem, we need to make sure we trick WordPress before this function is called. Luckily we can catch WordPress immediately after it (unsuccessfully) looks for posts before any other function can figure out anything is wrong by using the the_posts filter.

Continue Reading »

Blogger
Programmer
Web

Comments (35)

Permalink

WP_CodeShield

I’ve been burned a few times in WordPress when posting something like:

This is how you make text italic: This is italic.

when I actually wanted:

This is how you make text italic: <em>This is italic.</em>

Of course it’s not too hard to remember to encode the special characters but this is WordPress and things are supposed to be easy. So I thought I would throw together a simple WordPress plugin to convert HTML special characters inside <code></code> tags. That was a few months ago and I got the plugin most of the way done and then got distracted with other things. But after reading about another person having the same annoyance, I decided I should finish the plugin.

Continue Reading »

Blogger
Programmer
Web

Comments (25)

Permalink

Giant Fungus and Fossil Detectives

Science Daily ran an interesting summary about researchers verifying the identity of a giant organism found in the Devonian. I’ve always had a soft spot for the Devonian since the rocks in my hometown in Michigan are all from that period so I thought I’d take a look. Even without the childhood memories of brachiopods and trilobites, the Devonian is a pretty cool period in time from about 410 to 360 million years. In the ocean, nautilus-like ammonites flourished while the first bony fish and sharks evolved and radiated. On land, the Devonian started empty with only bacterial and algal mats covering the ground. By the end of the Devonian, forests of ferns and trees populated by insects and other arthropods were flourishing while our tetrapod ancestors took their first steps on to land. Between these two extremes of lush forests and barren ground, an organism whose identity remained unknown for a hundred years after it’s discovery developed and towered over the landscape.

A fossil Prototaxites from Hueber 2001

The first scientist, J. W. Dawson, to describe these fossil “logs” (like the picture to the left) thought they were palm tree-like plants and classified them as ancestors of conifers Prototaxites (Taxus is a genus of conifers). When Dawson presented his work in 1870, another scientist attacked it saying that the organism must be a form of giant algae and tried to illegitimately rename the genus. Dawson defended his decision for a while and then silently about-faced, renamed the genus (also illegitimately) and said he had never meant that to imply a relation to conifers. Although there were some suggestions for other classifications, the genus remained largely identified as an algae until 2001 when Hueber published a definitive 36 page paper on the subject.

Continue Reading »

Biologist

Comments (1)

Permalink