plugin tutorial

Child Page List

Join Us $17/year

The following shortcode is designed to list all pages that are immediate children of the current page. You may include just the title or the title with an excerpt and/or thumbnail of the child page.

Below is a list of all parameters with some examples of their use.

'post_type' => 'page'

This setting is optional. page may be substituted for any archival post type. For example if you created a custom post type called Favorite Artists with a slug of favorite-artists then that would go there.

Note: This is completely optional since the plugin is setup now to automatically detect the current post type and if it is set up to have children that is with sub-pages it should work. If for some reason it doesn't put the custom post type slug here.


include=''

If for some reason you only want selected child pages to show enter their post_id here. Comma separated list.

exclude=''

Same as above but will exclude specific child pages.


paginate='true'

posts_per_page='3'

These two work together. The default posts per page is three but if you would like to have a paginated list of your child pages (like there are many of them) then you may enter code as such.

[child-page-list posts_per_page='10' paginate='true']

will break the child pages in to 10 per page with pagination links.


taxonomy=''

order_by='numeric_order ASC'

Default setting above. May be ordered by numeric order which goes by post_id number. The three options are:

  1. numeric_order => Page Attributes > Order field
  2. menu_order => post_id number
  3. title => Which goes by the posts title in alphabetical order

You may add asc or desc to the above parameters so they may reverse the order.

order_by='title asc' will show from Z to A instead of A to Z.


show_thumbnail='true'

If you would like to include the pages featured image.

thumbnail_size='post-thumbnail'

Choose the exact thumbnail size. Defaults are:

  • thumbnail //Thumbnail (default 150px x 150px max)
  • medium //Medium resolution (default 300px x 300px max)
  • medium_large //Medium Large resolution (default 768px x 0px max)
  • large //Large resolution (default 1024px x 1024px max)
  • full //Original image resolution (unmodified)

Plus any other custom post thumbnail size. An example shortcode would be

[child-page-list show_thumbnail='true' thumbnail-size='medium_large']

Read more about thumbnails at the WordPress Post Thumbnails Codex Page.


show_excerpt='false'

When set to true will show the manual excerpt field.

show_content='false'

When set to true will show the pages (or custom post type ) content.

read_more_link='false'

When set to true will show link text read more... at the end of the excerpt or content. Whichever is chosen.

read_more_text='null'

You may change the text of the read more link to anything you like. For example read_more_text='Continue reading...'.


title_length_characters='false'

'title_length_words' => false

content_length_characters='false'

content_length_words='false'

excerpt_length_characters='false'

excerpt_length_words='false'

If you would like to shorten the length of the titles, content or excerpt you may do so here. For example you don't like your titles to wrap on to more than one line. The length_characters will do exact characters and the length_words will do the same but by whole words.


include_acf=''

If you would like to use a custom title instead of the actual page title you may create a custom field text field and put the title here (including raw code).

link_target='_self'

If you would like the links to open in a new window you would put link_target='_blank'

show_rating='false'

Works with the post-reviews plugin and if you would like to show the child pages star ratings then just change this parameter to ture.

page_has_no_parent='false'

Ignore this parameter and leave it at its default setting.

shortcode_id=''

If you would like to wrap the shortcode in an ID then just select whichever one you would like. For example

shortcode_id='books_child_pages'

hide_title='false'

If you would like to use your own custom title per page using the include_acf parameter above then you would set this to true. Works also if you only want to show images.

hide_acf_field_label='false'

So it won't show the name of the acf field put all field names here in a comma separated list.


Examples With Shortcodes

This link will show an example of a typical parent page listing its child pages. It is using the manual excerpt field for the content. First the shortcode used then the link.

[child-page-list posts_per_page='12' show_thumbnail='true' shortcode_id='inline_layout' show_excerpt='true' paginate='true' use_layout='inline' include_link_title='true']

Parent page with thumbnail, title and manual excerpt.

Example number 2. Below is the shortcode then the link to the page example.

[child-page-list order_by='numeric_order' shortcode_id='amsoil_warehouses' include_acf='custom_title' hide_acf_field_label='true' hide_title='true' posts_per_page='16']

Child page list with only thumbnail and custom title.

Using ACF for Custom Title

Note in the image I wrapped the title in <a></a> so the title will be clickable.

The design of the layouts were handled using custom css which I will give examples in another tutorial.

Join Us $17/year