Categories
Tutorials

Tutorial: Write a Sitemap Plugin Day 8

Today I complete two easy tasks: intercept the URL http://www.myblog.com/sitemap.xml to serve the sitemap (it will work only with WordPress on Apache and permalink active) ping Google when something happens in WordPress (eg. a post changed) The two modifications are very easy. The first is a matter to do a little parsing of request uri: […]

Categories
Tutorials

Tutorial: Write a Sitemap Plugin Day 7

If you try the sitemap plugin on a big blog, the sitemap generated can be broken. This is not an error of the plugin, but almost surely an out of memory error. In PHP there are many way to try to save memory, in out plugin I will change the main loop in this way: […]

Categories
Tutorials

Tutorial: Write a Sitemap Plugin Day 6

It’s time to make this sitemap plugin a little bit more “social”. How? As you learnt in previous lessons, WordPress has hooks that are called to give a way to “others” to make actions (over the default behaviour of WordPress). There are a lot (really a lot) of these hooks… and now we add one […]

Categories
Tutorials

Tutorial: Write a Sitemap Plugin Day 5

Today I add an options panel to the Sitemap plugin. Before start coding I have to define what I want this panel to do and the data to collect. the max number of urls to be added to the sitemap, blank value will mean “all” a checkbox to enable the integration with other plugins (features […]

Categories
Tutorials

Tutorial: Write a Sitemap Plugin Day 4

We are at the end. At least the last day to have the plugin really working. After this lesson, I will start a new series to add some features to this plugin (control panel, options, integration with other plugins). The last step is to print out XML elements that represent each single URL of our […]

Categories
Tutorials

Tutorial: Write a Sitemap Plugin Day 3

Now we have a working even if stupid plugin. Today we look at how get all the posts from WordPress to generate the real sitemap. WordPress have a special function named get_posts. But functions like that extract to many data from the database, we usually need only the post date and the permalink.

Categories
Tutorials

Tutorial: Write a Sitemap Plugin Day 2

Now we have a clear idea of the final product, so we can start to structure the plugin. Opsss, and the name? It can sound incredible but on the WordPress Plugin Directory the name “sitemap” is available. So our plugin will be named “sitemap”. Let’s start creating a folder named “sitemap” and the file “plugin.php” […]

Categories
Tutorials

Tutorial: Write a Sitemap Plugin Day 1

I wrote a number of plugins and every time I review the code of them I found someting can be improved or adjusted. I’m not talking about bugs but different way to implement the plugin actions. This tutorial will be a set of post where I dissect “my way to write a plugin”. I don’t […]