Adds a custom shortcode that returns the number of children for a given page. Accepts page ID, name, or slug as input.
You must insert the shortcode in location where you want to count to appear: (always replacing page-slug with an acutal slug name)
The shortcode assumes you are giving it slugs, but it can also accept page names or IDs:
[children type="name" page="Parent Page Name"]
[children type="id" page="28"]
Make sure you're using the correct page slug, sometimes they are different from the actual page name and capitalization matters. You can view them by clicking on the All Pages link under Pages.
Also don't literally copy "page-slug," you need to put the parent page you want counted there, that's just a place holder. So to count the number of children in a page called 'Book Reviews' with a slug name of 'book-reviews' you would insert
[children] is the primary one, but there is also [countchildren], [childcount], and [pagechildren].
Yes, just open
count-children.php and add or change what text you want to trigger the shortcode in the array near the bottom.
Can I? Yes. Will I? Yes, if I think it would be a helpful addition. I'm trying to keep things clean and simple, but there's always room for improvement, so let me know if you think a feature is lacking!
Requires: 2.8 or higher
Compatible up to: 3.5.2
Last Updated: 4 years ago
Active Installs: Less than 10
Got something to say? Need help?