WordPress FAQ: How Do I Fix the Blogroll Category Issue in WordPress 2.1

In WordPress 2.0.x there was a simple facility to bulk change the link categories for numbers of links. Unless I’m mistaken, that appears to have been dropped from 2.1.x.

I’ve just imported 52 links to what’s now called the Blogroll (it used to be “œLinks”) and have had to add the link category individually to each one. To say that’s time-consuming is an understatement, especially if you have lots of sites to do.

This question comes from John Evans who outlined the problem is greater details over at Syntagma.

First of all, welcome to the club, John. You’re not the first person to encounter this problem and unfortunately, you won’t be the last.

Depending on how many blogroll links you actually employ, your solution may be the easiest and quickest. However, if you have LOTS of blogroll categories and the upgrade from WordPress <2.0.x to WordPress >2.1 did not make the proper associations, you may not have as much luck. I discourage manual editing of the database in this case because there are multiple lines of logic and different fields that would have to be updated.

The good news is that as of this afternoon, I submitted new functionality for consideration in the WP core that would address this issue. The bad news is that this might not make the WP 2.2 release on April 23. If you feel comfortable applying your own patches, feel free and let me know how it goes.

WordPress FAQ: How Do I Use Child Pages More Effectively?

Hidden child pages on front page of site in new version of wordpress… any simple tutorial on making this happen or any plans on making this a function of wordpress in the future? It would really help wordpress have better functionality for those of us who also use it as a CMS.
I know it’s more of a templating issue. By default most templates place all pages at the top or sidebar. Well, truth is for organization sake, this is not always good. I like to be able to link to these (which is simple enough) but only have them display that link on the parent page rather than the front page (meaning “front” of blog”). This would be a great “built-in” functionality, but right now it’s not there.

This question comes from William Lehman and is fairly involved. In fact, several exchanges occurred before I completely understood what William was driving at. In essence, the issue is that “Child Pages” – that is pages that have been assigned a Parent Page – display on all pages when using the template tag

<a href="http://codex.wordpress.org/Template_Tags/wp_list_pages">wp_list_pages</a>

and he wants to only list a child page if it is the parent page that the reader is on.

Complex, right?

Not so much with a little Template Grease™

Let me provide a little pseudo code. As templates are very individual things, where exactly this is placed is completely dependent on where you want your code to be displayed and in what form you want it to be displayed in.

if( is_page() )
  wp_list_pages('child_of=' . $wp_query-&gt;query_vars['page_id']);

Okay, complex right? The bark is worse than the bite. First we do a little fact-checking. Are we on a page or not? This page load isn’t actually a feed? …Or an archive page? …or just a simple post? Right? Okay, then we move on.

Every page load in WordPress carries with it a set of query variables. No one ever sees these unless you go looking for them, but the query variables dictate how the page is loaded, if theres anything special that the rest of WordPress has to consider, such as categories or dates, or, if the page load is a page or a post. Having determined already that your page is actually a page and not a post, we can tap into the


object and extract the page ID from the query variables.

Having done this, we can pass this ID with it’s ubiquitous reference of


to the


template tag using the “child_of” argument. This argument tells the page list creator that we only want to find the subpages of this particular page that we’re on.

And that’s it. Naturally, you can explore the deepr treasures of

<a href="http://codex.wordpress.org/Template_Tags/wp_list_pages">wp_list_pages</a>

and style your navigation/page list accordingly. That should get you going in the right direction though.

Readers are welcome to send their questions in to me and I’ll do my best to give them a spin.

WordPress FAQ: Where did my Preview Link Go?

Where the hell did my “Preview Post” button go? We lost it with the Upgrade to 2.1, and I want it back.

This question comes from Cory Aldrich who echoes the sentiments of many WordPress users. In WordPress 2.1, the iframe that loaded the site in a window below the edit area of the Write screen, was removed. Mostly this was due to performance issue of loading a whole site inside a window. The outcry has been heard, however, and the Preview link has been restored to WordPress 2.2 – in a slightly different form. Changeset 5159 went back into the core on March 31st.

Feel free to email me your WordPress questions so I can help you get an answer.