WordPress Plugin – Block Rules
Block Rules is a simple WordPress plug-in that allows you to attach visibility rules to predefined template blocks. It is easy to use without additional programming effort. Out of the box there already is a set of rules that can simply be extended. The tool is currently available in version 1.0.0.1.
Motivation
Block rules was developed in the need of displaying a google adsense block only if a given posting was older than seven days, as we did not want to bother our readers, but people coming to our page using a search engine. Since all existing plug-ins were not able to do this, the idea came up to implement such a tool. After a while it was needed to display the same adsense block if a text was longer than 3000 characters. It was quite obvious to design the tool in a way it should be easy to extend the rules just implementing against an simple interface. Block rules was born and it is still used in this blog with the mentioned rules. Since we knew that we are not the only blog that needs such a plug-in we decided to release it under a creative commons license.
Rules
There is a set of rules that can be used out of the box and this set is growing fast, since everybody can easily write own rules. A list of all rules can be found in our rules section, as well as a how-to for creating new rules. At the moment following rules are existing: Posting older than, Text longer than and valid scope.
Installation
For installing Block Rules you have to download the current version from our server and copy it into the wordpress plugin directory, just like every other wordpress extension. Unfortunatelly it is not possible to create the needed database tables using the plugin installation trigger. Therefore you have to call the installation script manually using the following url:
http://your-domain.tld/wp-content/plugins/BlockRules/installer.php
This script will create the single table that is needed to run block rules. Now log in into the wordpress admin panel and activate the plug-in. Afterwards you can easily start creating your own rules. Now you can add a code block like this to your template:
<?php if ( showBlock( 'adsense' ) ) { ?> <div> I am a block that is not always displayed </div> <?php } ?>
This block will only be shown if all predefined rules, attached to the „adsense“ block identifier, are applying.
License
Block rules is published under a creative commons license. Please feel free to extend the tool and publish it. If you write new rules please send a mail to blockrules@phphatesme.com and attach it, so we can add it in the next release. If you are extending block rules please add a link to this page.
Release Notes
Version | Date | Changes |
1.0.0.1 | 2008-11-24 |
|
1.0.0.0 | 2008-11-23 |
|
Sehr nützlich, danke 🙂
Aber der RSS-Link ist ziemlich versteckt 😉