Child Pages Shortcode

With Child Pages Shortcode you can fetch the children of a page and arrange them in a nice list or overview. There are several ways to make use of the plugin. First you can use them in the code via hooks and second you can use shortcodes and a kind of template (that’s what I want to go into in this post).

Shortcode

You can use the shortcode like this:

This will print a list of all child pages:
Child Pages Shortcode - Default
There are some arguments you can pass optionally of course:

  • id – ID of page (Optional)
  • size – Post thumbnail size. e.g. ‘thumbnail’ or ‘large’
  • width – width of block for child pages.
  • disable_shortcode – Shortcode not work in the template if set true.
  • disable_excerpt_filters – filters not work for the excerpt if set true.

Well this is very “despicable” – to customize this view there is a template mechanism.

Template

At first we change to shortcode to the multiline notation like this:

Between this lines you get several information about the child page:

  • %post_id% – ID of the Page
  • %width% – Width of block for single page
  • %post_url% – Page permalink
  • %post_thumb% – for Post thumbnail
  • %post_title% – Page title
  • %post_excerpt% – Page excerpt

An interesting (and not documented) way to use this:

This is the default template with highlighted lines – this is the place where you can edit the template (with use of the provided scaffolding by the plugin – of course you can also mess around with the whole template). I added a link to the page for example.

Now that you know the basics about using templates we can go further – I want to add a “pseudo” child page (that is actually not a page but useful to display in the same kind beside the actual sub pages). For example I list all my projects but there are also links to external project sites.

So we can change the code like this:

Of course you can use all other shortcodes in this content like I did with bs_button.

There are several ways to hook into the display process.

Conclusion

Hopefully you got an idea about the features of Child Pages Shortcode! It is really easy to use and very powerful. Please leave a comment below and describe how you use this plugin.
Child Pages Shortcode

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Spelling error report

The following text will be sent to our editors: