Wordpress Plugin: Category Link Manager

I can’t really call this a new plugin. If you look under the hood, most of codebase is just a reworking of the popular Page Link Manager. It’s one of the nice things about Wordpress plugin development—being able to borrow ideas from similiar plugins—and it’s what makes scripting for Wordpress enjoyable.

The motivation behind this plugin is the fact that excluding categories is somewhat of a barrier to those of us who are not programmers. It used to be that we would have to dig through PHP templates and add exclude=2,7 to the wp_list_cats tag. To clients or anyone not familiar with the Wordpress system, that may seem like an impossible task. And, for those who are comfortable with the Wordpress system, it can be just plain annoying. The Category Link Manager attempts to make things just a little bit easier.

One last note: I’d like to thank Valerie for sharing this idea with me.

The Plugin

The Category Link Manager Plugin is a Wordpress plugin that adds an administration panel that allows users to pick which category links are included in the site navigation. It also provides a function that uses these settings to replace wp_list_cats. Adding it to your Wordpress installation is as easy as ever.

  1. Download and unzip the plugin archive.
  2. Place the plugin file under wp-content/plugins directory on your Wordpress Installation.
  3. Log in to your admin interface and activate Category Link Manager under the ‘Plugins’ tab.
  4. Go to the new panel under the ‘Manage’ tab called ‘Category Links’.
  5. Select and update the categories you want included in your site navigation.
  6. Open the source of the template file where you call the wp_list_cats function (the default file is sidebar.php, however it may be different if you’re using certain plugins) and replace it with gdm_list_selected_cats.

If you’re wondering, gdm_list_selected_cats is what does all the work for us. It takes the categories we chose to include in the navigation and works out what categories it should exclude. Besides that, it acts exactly like wp_list_cats—it even takes the same parameters.

Here’s a few examples of what we can do:

// sort the categories by name
gdm_list_selected_cats('sort_column=name');

// sort the list by name and show empty categories
gdm_list_selected_cats('sort_column=name&hide_empty=0');

// sort the list by name and manually exclude 
// additional categories
gdm_list_selected_cats('sort_column=name&exclude=2,7');

Like my other Wordpress plugins, I hope to keep this plugin going as a work in progress as it helps make content management just a little bit easier. If you have any problems, questions or suggestions, please let me know.

Requirements

The current release requires a server running at least PHP4. The plugin has been tested on Wordpress 2.x. If anyone has gotten it working on older versions of Wordpress, please let me know.

Download the Plugin

All source code is provided under the Creative Commons Attribution-Sharealike License. If you agree to these terms, please download the plugin now.


Localizing the Page Link Manager Plugin

For the next release of the Page Link Manager (v0.3), I’d like to add some localization to the plugin (especially with all the international attention it’s received).

I’m a guy who thinks that Wordpress wouldn’t be the success it is without the community involvement around it. So, I’m currently looking for some volunteers to help translate some of the output the plugin produces. It’s pretty much just small, but important, things like page headings and form labels and instructions. I’d like to get as many translations as possible for this next release, and I’m open to taking any localizations people are willing to provide.

If you’re interested in helping out, please download the translation file and email it to .(JavaScript must be enabled to view this email address) once you’re done.

Just for the record—I took four years of Latin in high school, so unfortunately I can’t really contribute any translations for the plugin—unless someone really, really wants a Latin version.


Page Link Manager API

Get connected! Since lauching the Page Link Manager Plugin earlier this week, a lot of people have asked if it will work with such-and-such a plugin. And although I’d love to go through and try to get it to work with as many other plugins as I can, that’s just not possible. So, I’ve decided to write and release some functions to the development community. That way, if you want to get your plugin to work off some of the functionality of the Page Link Manager, it should be pretty painless.

The Functions

Since this is a new feature with this release (v0.2), there are only a few, but powerful, developer functions available.

bool gdm_is_excluded_page($id)
$id (Required). The page ID in question.
Returns TRUE if Page Link Manager has the page registered as excluded.

array gdm_get_excluded_pages()
Returns an array of all the pages Page Link Manager has registered as excluded.

string gdm_page_links_rebuild_query($query)
$query (Optional). A wp_list_pages style query string.
Rebuilds and returns a query string with dynamically generated exclude values.

If there’s anything you’d like to see added in the next version, please let me know.

Download Now

All source code is provided under the Creative Commons Attribution-Sharealike License. If you agree to these terms, please download the plugin and developer functions now.


WordPress Plugin: Page Link Manager

WordPress is a fantastic tool—I can’t say that enough. I was able to migrate my old site and structure over to the WordPress model quite quickly, and in a matter of minutes I was blogging. But one of the major hurdles is that it still relies on coding knowledge a bit. For example, under the current version of WordPress, to exclude a pages from site navigation, you have to go into the source and do something like wp_list_pages(‘exclude=3,7’). And, if you add other pages you don’t want listed in the site navigation, you have to go into and edit the source each time. This became an obstacle recently when my sister and I began looking at WordPress as a viable content management system for clients’ use. It seemed silly to us that each time the client wanted to include an excluded page or exclude a new page they’d have to call on us, or we’d have to teach them some elementary programming skills. And so the Page Link Manager Plugin was created.

The Plugin

v1.0b Release Changes (February 23, 2009)

This is a feature release. Upgrade when you can.

Pages Widget
The new version replaces the default Pages widget and creates a custom widget that duplicates the Pages widget functionality, but improves it by adding checkboxes to allow excluding individual pages.

I realize this is a big leap from v0.3, so if you feel anything is missing, out of place or needs some work, please let me know in the comments.

The Page Link Manager Plugin (I know it’s a mouthful) is a WordPress plugin that adds an administration panel that allows users to pick which page links are included in the site navigation. Adding it to your WordPress installation is as easy as ever.

  1. Download and unzip the plugin archive.
  2. Place the plugin file under wp-content/plugins directory on your Wordpress Installation.
  3. Log in to your admin interface and activate Page Link Manager under the ‘Plugins’ tab.
  4. Go to the new panel under the ‘Tools’ tab called ‘Page Links’. If you use widgets, you can access page link settings through the Page widget.
  5. Select and update the pages you want included in your site navigation.

Note: Now that the plugin works with wp_list_pages, gdm_list_selected_pages has become deprecated.

Here’s a few uses of the wp_list_pages function:

// add a heading to the page link list
wp_list_pages('title_li=

Pages

');

// sort list by the menu order
wp_list_pages('title_li=&sort_column=menu_order');

// add a heading to the page link list and
// exclude a couple extra pages
wp_list_pages('title_li=

Pages

&exclude=4,7');

Take a look at that last example again. Can we just manually exclude pages that way even if the function’s loading pre-defined excluded pages? Of course we can. The function’s designed to look for and deal with manual page exclusions.

I hope to keep this plugin going as a work in progress as it helps make content management just a little bit easier. If you have any problems, questions or suggestions, please let me know.

Requirements

The current release requires a server running at least PHP4. The plugin has been tested on Wordpress 2.5+. If anyone has gotten it working on older versions of WordPress, please let me know.

Resources

If you’re interested in writing plugins, the WordPress Plugin article is an excellent resource.

Download the Plugin

All source code is provided under the Creative Commons Attribution-Sharealike License. If you agree to these terms, please download the plugin now.