SB Child List

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):

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 :)

 

181 comments

  1. paolo says:

    Hi Sean

    How can I add a class to the li?
    I want to style the li, not just the link.

    cheers

    • Sean says:

      I will add this functionality to the next version.

      thanks
      Sean

      • Toon says:

        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”)

  2. RIchard says:

    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,

    • Sean says:

      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

  3. Duc says:

    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.

    • Sean says:

      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

  4. madison says:

    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.

  5. 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

    • Sean says:

      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

  6. Tal says:

    Hi Sean,

    Can i have the child list pages with thumbnail of the feature image and excerpt?

    Thanks
    Tal

  7. Robert says:

    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

  8. Pete says:

    Hi Sean!

    Your plugin seems pretty nice! But how can I get a excerpt and a picture into this list?

    Greetz,
    Pete

    • Sean says:

      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

  9. Ben Brundell says:

    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

    • Sean says:

      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

      • Ben Brundell says:

        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

        • Ben Brundell says:

          Sean: I apologise for naming you Shaun in the last comment! Sorry.

        • Joshua says:

          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' ]

  10. Lili says:

    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.

  11. Lili says:

    NEVER MIND :-) Found the answer upstream (orderby=”title” order=”asc”)

Leave a Reply