Hi everyone,
I'd like to list all child pages of the current browsing page. But my URL is: http://www.domain.com/pageTitle
I googled it and found the code which works with this type of URL: http://www.domain.com/?page_id=123
I tried to use the_title(); to get the current page title and tried to convert it to string, then use the get_page_by_title(); to get the page ID.
But it doesn't work.
This is my code:
<!-- List child pages only -->
<?php
//$this_page_title = the_title();
$this_page_title = 'the_title()';
$this_page_id = get_page_by_title($this_page_title);
if($post->post_parent)
$children = wp_list_pages("depth=1&title_li&child_of=.$this_page_id->ID&echo=0");
else
$children = wp_list_pages("depth=1&title_li&child_of=.$this_page_id->ID&echo=0");
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
<!-- // End list -->
Please help me!
Thanks in advanced!
PS: I don't know what differences between .$this_page_id, .$this_page_id. and $this_page_id. Please explain.
(sorry if my english bad ^^)