This plugin lets you turn WordPress into a proper easily navigable CMS. Having a site made up mostly of pages in the form of a tree (an information site for example) was always a pain until I wrote this to help me out. I have had lots of feedback about it over the last few months and more and more people are finding ways they can use it to improve the navigation and usability of their sites
I wanted to show some sort of hierarchy in the pages inside WordPress. I decided to call one of my pages “articles” and have my articles use it as their parent.
Logically you would expect to see a list of the child pages on the articles page along with a pretty picture and some intro text. This doesn’t seem possible natively with WordPress so I decided to make it happen.
Usage
Adding the hook [ sb_child_list ] to any post or page will by default show an unordered list showing the children and links to them. If you prefer to style it yourself then don’t worry because you can do that too using the templating system on the settings page.
There is also add another tag, [ sb_parent ], that allows you to provide a back to parent link from any child. This enables you (in the articles example) to add a “click here to read more on this subject” link. It is also template based so it can say anything or look however you see fit
Category Listings
You can also use this shortcode: [ sb_cat_list category=CatName ] which does what it says on the tin, simply give it a category name and it will show the posts in that category for you with optional ‘limit’ argument
The plugin creates a widget for use also. This works if there is a sub page present. Much like a sub pages widget or similar.
I have added a shortcode for sibling navigation. You can use [ sb_sibling_next ] and [ sb_sibling_prev ] to show links to next and previous pages ordered by menu order followed by post title order. Handy indeed!
Templating
There is a simple templating sytstem to allow multiple templates for [ sb_child_list ] and [ sb_cat_list ] with the argument ‘template’ ([ sb_child_list template=”2″ ]). Also added excerpt support and support for the SB Uploader Plugin custom fields (custom field called post_image will show if necessary).
Shortcodes
[ sb_child_list ] <-- Arguments allowed are: 'template', 'nest_level' and 'order' [ sb_parent ] [ sb_grandparent ] [ sb_cat_list ] [ sb_sibling_next ] [ sb_sibling_prev ] Example Site
I wrote this plugin so that I could display articles in a hierarchy on my boat site (Still in development). See examples of how I am using it at http://www.letsboat.co.uk/ on the articles page. I have updated the CSS to fit it in with the rest of the site.
Screenshots
Download
Latest version is in the WordPress Plugin Directory here: http://wordpress.org/extend/plugins/sb-child-list/
Download an old archive version here (V1.0): [download#5#size#nohits]
Note
Shortcodes in this post have had spaces added before and after so they show and aren’t turned into lists of posts by WordPress. A consequence of using the same plugin on the site you are advertising 🙂
Hi Sean
How can I add a class to the li?
I want to style the li, not just the link.
cheers
I will add this functionality to the next version.
thanks
Sean
Sean,
If you add that functionality, could you then add a different class to the of the current page. That way we can style (or ‘display:none’) the link for the current page. Although I think it is strange to have a link to the same page as where you ar at.
Or, better yet, the possibility in the widget settings to leave out the current page (e.g. ”Show current page?: Yes | No”)
Nice idea, I will look into it!
ta
S
I think the current page should be there but not clickable. I think it will make navigation easier.
The problem is that whilst you think that others might not think the same so making a change like this could cause issues for others. I will consider making it a setting though for you for the future.
Thanks
Sean
HI love the plugin thanks,
Is there away of highlighting in the child list widget the parent article to separate it from the children?
Thanks,
Hey Richard, you can use [sb_parent] I think but not sure if I have written a way to allow you to identify the parent page in the normal list. Thanks for the feedback thought. Will look to change that for you for the next version.
ta
S
Hi Sean
Thanks for the plug-in, I have been looking for such a solution for ages.
However I can’t seem to use it and I don’t understand why. I added the line [ sb_child_list ] in my wordpress page editor and there was no menu trees displayed at all. The line [ sb_child_list ] appeared as text in my page on the browser instead.
I don’t know what I should do more or what I did wrong. Can you explain to me the process of using your plug-in again? Thanks very much.
Hi Duc,
The only way that the shortcode would show would be if the plugin was disabled or if it was spelt properly. Remove the spaces too, shortcodes don’t work like that.
ta
S
Hey Sean,
How does order work? Tried
[ sb_child_list order=”ASC”] and get nothing. Without order in shortcode, the list is fine, just not sorted. Looking for a way to sort the results alphabetically. Any help much appreciated.
Hey Madison, I have just released a new version where you can use both orderby and order to get the result ordering you want. Let me know if you have any more ideas or bug reports.
ta
S
Can you please give an example for how to have sb_child_list sorted alphabetically? Thank you!
Got it!
sb_child_list orderby=”title” order=”asc”
I found this only worked it you dropped the quote marks, e.g. orderby=title order=asc
Hi Sean,
I’m trying to get the nav bar to remain highlighted with the relevant selection when I go two levels deep into the nav. It works for me when I go one level deep, but not 2. I see that this works on your boat site, ( For example, this page still shows “About” as the selected menu option on your site: http://www.letsboat.co.uk/articles-2/4-berths-beds/ ) so I’m wondering what I am doing wrong. Please help! Thanks
Hi Brandon,
When you go a couple of levels down you should see an ancestor or parent class appear so you can hook into that. Maybe that works for you?
Let me know
ta
S
Hi Sean,
Can i have the child list pages with thumbnail of the feature image and excerpt?
Thanks
Tal
Yup.. see another comment to Phil recently..
ta
S
Hi Sean,
Great plugin! I needed it to work with tags, so I made 4 little changes to the plugin – adding a sb_tag_list short code – and mine now works with tags as if they were categories. It would be a great feature to add to the next update. If you want to see my code, email me.
Thanks, Robert
Hey Robert,
Yes please. If you send it to me at barton.sean[at]gmail.com I can add it to the next version for you if you like.
ta
S
Hi Sean!
Your plugin seems pretty nice! But how can I get a excerpt and a picture into this list?
Greetz,
Pete
Hi Pete,
I just checked the code. You can use [post_image] and [post_image2] as custom fields whereby you provide the URL or you can use [post_thumb] or [post_thumb_url] to get the post/page featured image for the list.
ta
S
Hello and thanks so much for this plugin! I don’t understand why people think the built-in functionality in WordPress is fine for CMS use. One feature request: would it be possible to amend the shortcodes to allow passing of an image size to the thumbnail? This would allow people to take advantage of the thumbnail re-sizing for different menu systems.
Thanks
Ben
Thanks Ben.. you asked.. you got. Now you can add thumb_size into the shortcode arguments for any of the two main shortcodes and it will reflect the size you asked for on [post_thumb]. Let me know if this works for you on the latest version (3.6)
thanks
Sean
Hi Shaun and thanks so much for the quick response! I’ve had chance to try it but am unsure of the syntax. I’ve tried [post_thumb thumb_size=”medium”] with and without quotes. Should I be using a pure px size?
Thanks
Sean: I apologise for naming you Shaun in the last comment! Sorry.
Hi Ben,
I’m not sure if you’ve got your answer but what Sean means is that you can add thumb_size as a parameter to the [ sb_child_list ] shortcode. The value of the parameter, I assume, matches the WordPress keywords for the different image sizes (thumbnail, medium, large, full).
Using v4.0 of the plugin, this is what works for me: [ sb_child_list thumb_size=’thumbnail’ ]
Hi Sean, I am still having trouble with the ordering. Just trying to order by title. The following is not working:
[sb_child_list order="post_title"]
See here:
http://www.fishmaui.com/maui-sport-fishing/sportfishing-boats
Please help. I use your plugin on 3 different sites, and ordering is really important.
NEVER MIND 🙂 Found the answer upstream (orderby=”title” order=”asc”)
I’m getting Warnings displayed on pages about mysql_real_escape_string function calls (lines 219 and 220). Looks like it expects 2 parameters, but it only gets the string to escape. I’m not seeing this issue on all hosts, so it could be related to specific php and MySQL versions.
Any ideas?
It’s related to the PHP version I believe and not MySQL. You’ll see it a lot in the future as the function it’s throwing an error on is extremely popular. If you set your error_reporting value on the server to E_ERROR which will only show fatal errors you will shield yourself from this sort of thing for a while.
ta
S
Hello Sean: something unusual here! I’m using your wonderful plugin on my site and it works great. When I try to add the same shortcode to the Home Page, the plugin fails producing no output at all.
I’ve installed Autonav (which does work on that page), but would prefer yours.
I tried adding the parent_id argument. I know this in itself does work on the home page (I can output a list of children of another page). When I add the ID of home it fails, so I went through the DB and used an ID of “0” which doesn’t work, either!
So…not sure whether it’s me or not but wonder whether you’ve seen this before?
Best wishes
Ben
Hi, Sean,
I would like to show only the first level of sub-pages, not the children of children sub-pages. Possible?
Hi Andrea,
Yes it should be possible. Simply select the level in the settings to 1. It will only then present a single level of child links
Thank you, Sean! Somehow I missed that… too many hours at the computer, no doubt! I also discovered I can do it on a page-by-page basis using nest_level=1. Perfect! This is a great plugin for those top-level pages that are clickable, but contain only introductory information. With the SB Child List shortcode added, the page becomes much more valuable and user friendly because of the added navigation the list provides.
Hmm… The nest_level argument doesn’t seem to be over-riding the global setting for nested levels, Sean. What is the nest_level argument for?
Hi Sean, wonderful plugin – I’m using it on a lot of my site. Is there any way of excluding grandchildren / just going 1 level deep?
idiot – I’ve just seen the post right above haha. Sorted. Thanks for a great plugin.
Hi Sean
Wordfence is starting to moan because this plugin hasn’t been updated in ages and is not certified as compatible with the current version of WP. Do you have any plans to update it?
Damn ok.. I’ll get it updated asap.
Hello Sean, I am also still using this plugin and with me Wordfence us amking comments as well.
Sorry, I’ll throw a quick update in soon.
Hello Sean,
I wanted to ask if this great plugin is still being developed or updated. Would be a shame if not! Or do you have an alternative now?
Kind regards
Serge
Hi Serge, not really.. it’s probably ten years old. It was a great little plugin whilst it was used but I am sure that others are available these days. I believe the plugin still works though
Sean