wpDirectory WordPress Plugin
Howdy!
As you might ave already noticed, WordPress is an excellent blog platform, however its infraestructure is so flexible that you can use it for other projects different than blogging too.
This is my first plugin released for the public, I must say I have dedicated a lot of time understanding how WordPress’s plugins work and even when sometimes was hard to find he right code to make it work out of the box, there’s always an easy way to achieve almost everything you want with just wordpress functions.
So, here we go: The objective and main task of this lugin is to show a structured list of categories on any page (home or any) of your WordPress installation. That’s it. I have also included some functions to improve the admin interface for users and contributors. I expect to release an ajax version in the near future.
Plugin Features
- Category description in link title.
- Show/Hide Subcategories
- Show/Hide Amount of articles in parent and child categories.
- Show/Hide empty categories.
- Display categories on specified amount of colums with automatic reordering adjusting to user’s resolution.
- Use hierarchy for subcategories.
- Exclude selected categories.
Special features:
divpowered listing, so design can be easily modified using CSS,a s you need. The parent category is inserted in a<div>container to mark it out with CSS as a parent.- Parent category is showing amount of articles in subcategories. The character also include the number of articles in this parent category.
- Display the specified amount of child categories (2nd level).
- Exclude child categories articles from the parent categories archive pages.
- You can add icons for parent categories using CSS.
- User can access to article’s source code.
Future Features:
- Ability to show all subcategories in listing powered by ajax.
- Show domain stats and relevant information about domain (for link directory)
- Integration with TDO miniforms
Admin interface options:
- Can prevent the listing have more than one category
- Show warning to author, if not selected any category or if selected more than one category.
- Hide unnecessary blocks from the “Write/Edit Post” page, if this is not the site administrator. It is “Comments & Pings”, “Excerpt”, “Password Protect” and other blocks. I.e. actually there is only a form of adding the article and the button to send it to moderation.
- Specific height of categories block on “Write/Edit Post” page.
- Custom “Terms of item publication” on “Write/Edit Post” page.
Installation
- Copy the
wpdirectoryfolder in WordPress plugins directory (/wp-content/plugins/). - Copy the
categories.cssfile in directory of your current THEME. - Activate the plugin through admin interface.
- You can call the categories listing on any page throught this function:
- Options are optmized, however you can customize them in in admin interface at the “Options -> wpDirectory” page.
<?php wpdirectory(); ?>
Add the following code in the index.php (or another file) of your THEME:
<?php if (function_exists('wpdirectory')) wpdirectory(); ?>
The plugin also lets you to display the list with the links to categories RSS feeds. To do this, you must:
- Create a new page template.
- Add the following code:
<?php $rssfeeds=true; ?> <?php if (function_exists('wpdirectory')) wpdirectory(); ?>
Customization
You can customize almost everything about this plugin (that’s in first place why I created it):
- wpDirectory comes with a file (categories.css), you can customize it to match the colors fo your site. There’s no need to call the file, since its loaded automatically by the plugin and should be inside the plugins’ main folder.
- Customize options on “Settings → Article Directory” page.
You can also display the list with their respective RSS feeds for each category. In orde to do this, you must:
- Create a new page template.
- Add the following code:
<?php $rssfeeds=true; ?>
<?php if (function_exists('wpdirectory')) wpdirectory(); ?> - Create a new page in the admin interface and select the created template.
How to add icons for parent categories
Very simple, just using CSS. You need to add the styles for icons in categories.css or in style.css file (style.css is located in your current theme folder).
Styles should be like this:
#cat-23 {background: url(images/icon.png) 4px 3px no-repeat}
Here the digit 23 means: This icon will be added in the 2nd column for the 3rd parent category from the top. Accordingly, it is necessary to create as many of such styles, how many you have parent categories, and specify the corresponding number for each icon.
images/icon.png – this is the path to an icon file, beginning from a folder with your theme.
4px – icon shift value from the left of the parent category block.
3px – icon shift value from the top of the parent category block.
Might seem silly to to id in this way, but I wanted to ensure that works with any custom settings used for run the plugin, I might change it in the future to make it easier.
Download
You can download this plugin from WordPress, here: wpDirectory
Version history
Version 1.0 (20.12.09)
- Initial release of the plugin. No bugs or problems found in private beta.
Palabras Clave:
- wpdirectory demo
- current category rss and subcategories wordpress plugin
- wordpress hide subcategory
- wp directory demo
- wp hide subcategory in the article
- wpdirectory demo plugin









{ 15 comments… read them below or add one }
I can´t understand how to configure the items in the directory. Is not clear.
Thanks Ariel.
Hi Fran,
I don’t understand what you need to configure. With this plugin you can list categories and subcategories just like a link or bussines directory. I used the term items for subcategories also.
Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!
Installed on 2.9.1 but this did not work. I was trying to display the categories on main page with the number of articles under it..
@tuba Thanks for letting me know about it.
Working now
can this be used to build a business directory?
Like Fran, I’m confused regarding what categories or lists this shows. Where would I add that information for the directory? When I install it, it shows me a blank page, which is exactly what your demo page shows – empty space. If I want to create, for example, a directory of people and phone numbers, where would that information be added?
@Mike: You can easily achieve that using custom fields and modifying the way a post is published. Also, you can just upload all the needed info in a simple post.
@Vinofilus: We are still experiencing compatibility issues wih 2.9.1 (Still checking new code), hope to fix it soon.
Not working for me either on clean installation of wp 2.9.1… getting blank page
I know why…
The instruction say:
But the function isn’t exist, need to be:
Hi Sam, would please repost this?
I dont know if the problem is my code or in WP 2.9.1
tnx
Hola Ariel!
Tengo surgencia…y si ya esta algun lugar, disculpame por favor. Otro persona mencionado que hay un “demo”…pero no lo veo. Tal vez dos o tres versiones de demos es buen idea…especialmente una ejemplo de ‘directorio de negocio’. Tambien, “screen shots” para sus paginas aqui:
http://wordpress.org/extend/plugins/wpdirectory/
Gracias para sufriendo entre mi practicar el Español.:) Que tengas buen dia.
Jim
Hola Jim,
Primero, disculpa por responder tan tarde.
Sobre la “demo”, dejó de funcionar cuando hice el upgrade a WP 2.9 Todavía estoy mirando el código, sin embargo, no puedo hacerlo funcionar.
Intentaré rehacer el plugin, gracias por probarlo.
Followed your directions to a t, but unfortunately get the following error message on the front end:
Fatal error: Call to undefined function wp_directory() in C:\wamp\www\client_name\wp-content\themes\clienttheme\page.php on line 32
Oh Dave,
Im so sorry, that’s a huge mistake from my part, you should only use this function:
wpdirectory();
not wp_directory (note the underscore)
This Post has been updated, sorry for the problem.
ps. Demo is online now!