Posts tagged Development
Write your own plugin for WordPress [Chapter 3]
As a reminder, this article is the third of a series called Write your own plugin for WordPress
1. Plugin activation
When a WordPress plugin becomes active, it might be interesting to do some processing (such as database creation, options filling, and so on…). To do so, WordPress is providing a very usefull function that will enable you to call your own initialisation function. It’s called register_activation_hook($file,$function);
(more…)
[ZdStats] & [ZdMultilang] Plugins updated
Here is a quick post just to tell that I’ve updated my main WordPress plugins.
ZdStatistics
ZdStatistics will now allow you to check your blog’s performances, using SQL Queries count and Page load time. Don’t worry, version 1.1.5 will allow you to get performances through a chart. This will allow you to see major changes when activating various plugins.
Another function introduced in this version is the Top Ten. This will show you top ten pages, referers or visitors over a period of time.
Btw, remember that if you upgrade the plugin, you’ll have to grab the latest GeoLiteCity.dat as described here.
ZdMultilang
Thanks to the update of ZdStatistics, I could identify a major problem with ZdMultilang, which was the huge amount of Sql Queries made to the database.
So this is the only change for this version, I cleaned up the code and optimized Sql queries to give it more performances. As an example, my main page got from more than 240 queries to display to only… 23. Globally, I use a caching technique that will make no more than 10 queries on your pages.
Add dynamic charts to your site
There are many solutions existing out there to display charts into your pages. Indeed, whatever your reason is to include dynamic charts, it’s often necessary to use third part applications.
It’s never easy to generate them all by yourself, save it as an image and then upload it on your server.
That’s where some applications will come to help you with this problem. (more…)
Write your own plugin for WordPress [Chapter 2]
As promised before here is next article from the Create your own WordPress plugin series.
In this article, I’ll explain the structure of a plugin. More exactly the skeletton of a plugin file used to create them and also some specific concepts.
Plugin’s skeletton
A Plugin is composed of at least one php file (it’s not necessary to have more than one, but it’s better to split your code in multiple files for reusability). This file has a specific structure.
(more…)
[ZdStats] Update 1.1.3
It’s been nearly a week since I finished ZdStats version 1.1.3, but I couldn’t find time to update it on WordPress.org. So I’ll put it here until I can put it on wordpress’s svn. This version has been awaited for lot of people because it fixes some issues, but more importantly it includes some features that have been waited.
Here is the changelog :
- Addition of a function you can include within your theme. This function will display alltime pageviews for a specific url.
zd_stats_Display_Pageviews($URL);
You can include it into your loop like this:
zd_stats_Display_Pageviews(get_permalink()); - Addition of a Widget. It will display misc information that you can setup into widget options :
- Top referers
- Weekly pageviews
- Monthly pageviews
- All time pageviews
- User Level filtering. This option will allow you to filter users with a level Superior to the level set in the options.
- Bug correction: Auto creation of the IP Filter was not working properly. To correct your filter, you must empty the option box, deactivate the plug-in then reactivate it.
- Bug correction: Accents in the geolocalisation are now displayed.
Download
You can download it here, until I put it on WordPress’s SVN and it gives you the automatic update option.
Write your own plugin for WordPress [Chapter 1]
Here is my first article from a series : Write your own plugin for WordPress.
How does plugins work
A plugin is basically a php file included within WordPress at startup and plugged into the core. When I say file, it can be a set of files, but only one will permit recognition by WordPress by using a specific header.
The fact that active plugins are included at startup forces developers to name their functions with unique identifiers. Some developers therefore prefer to use classes.
Shell script, how-to make them look better
When you program a shell script, it’s always usefull to have some message reporting immediatly such as OK or Error. So here is a little how-to get color in your shell scripts.
In order to do so, you just have to use ASCII characters within your command-line. This will make them more eye appealing.
The syntax is the following :
echo -e 33[X;Ym_TEXT_33[m
with X:
0-> normal color
1-> bright color
3-> dark color
4-> underlined text
7-> highlighted text
9-> strike through text
With Y being the code for the color :
30 = Grey
31 = Red
32 = Green
33 = Yellow
34 = Blue
35 = Purple
36 = Cyan
ZdStats, update and PHP4 compatibility
Here it is, the brand new version of ZdStats (version 1.1.2). You can download it on this site and also on wordpress.org.
Changelog:
- Added default options, when installing the plugin, you won’t have to put the filters yourself, they will be automatically added (if not present).
- Better date calculation, it’s now PHP4 compatible
- Monthly Average (projection made according to the period you selected).
- When you do an upgrade, GeoLiteCity.dat will be erased, if so, the plugin will alert you to download one (if you need this functionnality). It will tell you where to get it and where to put it.
- Links to IP history navigation anywhere an IP adress is displayed.
- Detail of a pageview anywhere a time & date is displayed.
- Google Maps integration (via links) for each geolocalisation. This will allow you to discover new places
As always, don’t hesitate to leave comments and feedbacks.
[WordPress] New statistics plugin being coded
3 days ago, after buying my brand new laptop, I decided to develop a new Statistics system for wordpress. As I’m not satisfied by the one I found (Wassup, WP_Stats) I started to code it starting last Sunday. In fact, I already have lots of functionalities ready to be coded because I’m taking inspiration from a system I developed for my homemade CMS.
All this means that I’ll be able to fetch useful statistics directly from my own wordpress installation, I’ll be able to decide the filters in place for Bots/spammers/etc… and will not rely on hidden filters functionalities. Moreover, this means that your filters in this plugin are options ! YOU can decide of what is filtered or not. The more people will share their options, the more reliable the system will become.
The system is built this way, Three options:
- First, a list of IPs excluded from collection (useful for home IP, @work IP, etc…)
- Second, a list of User Agents corresponding to Robots with a name association (example : Mediapartners-Google => Google Adsense)
- The Third is a list of IP adresses considered as spammer or robots with non site friendly UserAgents.
Once these options are set, the data collection is started and allows you to consult statistics
Of course, administration pages are excluded, so are 404 errors. This is a question I ask myself, should I include them with a specific code so that we can find broken links ?
For the moment, only three main functionalities are coded : Summary for a specific period (chosen from a dropdown) with visitors and pageviews. Daily detail hour by hour. And finally, indexation from Search Engines.

I’m giving myself two weeks before publication of the First version of the system, but be aware that it’s already working as it’s installed on this very blog.
Meanwhile, do not hesitate to leave comments here for queries and suggestions so that I can work on them and include them.
Thanks for your support
WordPress, new theme
After creating the Stars and Grass theme, and after showing my capacity to create themes for wordpress that may fit some users need, I was asked by Nolwenn from Abc-Cooking to create a theme based on cooking for her Cooking blog. This is now done with her new theme based on Sandbox. This is a 3 column theme with two sidebars, on the left and on the right of the main column. Of course, they are widget ready.
This theme, like Stars and Grass is completly french/english bilingual as Abc-Cooking is a french blog opening an english version soon.
You can see the new theme in action on Abc-Cooking.
Of course, this theme is not available for download as it was made only for Abc-Cooking, but you may ask the owner for permission to have it.
