Example :
About
--- technical
--- medical
--- historical
--- geographical
--- political
how to create a function like this ?
function get_child_pages_by_parent_title($title)
{
// the code goes here
}
and calling it like this which will return me an array full of objects.
$children = get_child_pages_by_parent_title('About');
Why not to use
get_children()
? (once it's considered to use ID instead of the title)Check the official documentation.
I would prefer doing this without WP_Query. While it might not be any more efficient, at least you'd save yourself some time not having to write all those while/have_posts()/the_post() statements yet another time.
You can use this, it does work on page ID rather then title, if you really need page title, I can fix it, but ID is more stable.
It's all documented here:
http://codex.wordpress.org/Class_Reference/WP_Query