I want to output all sub-pages of a particular page in a neat
ul li list. Including: featured image, title, and first 50 characters of page content.
I'm very new to Wordpress, I've tried reading through the codex and I seem to have found something but I cannot get it to work.
First, I have created a new template of "list page" (listpage.php) so that I can choose pages where I wish them to list out sub pages.
I still need the content of that page to display, and the
ul li list to output below, essentially so the client can add some intro text.
Here is the code I have from the codex
<?php get_page_children( $page_id, $pages ) ?>
I tried to change the parameters to meet my requirements, the page ID is page 6 (you can see it here)
I cannot work out what the
$pages parameter is meant to be, but looking at other examples on the Codex page it seems that
$all_wp_pages can be used.
So I tried this:
<?php get_page_children( $6, $all_wp_pages ) ?>
And got an error:
Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /mnt/vol2/home/b/a/barkin10/public_html/wordpress/wp-content/themes/Yasmin/listpage.php on line 27
So I really don't know what I'm supposed to be doing :(
Even if this did work, because I have to put the page ID it has occured to me that this
listpage template will only be useable on the page that the ID corresponds to. I want to be able to give any page a template of
list page and be able to output the children (featured image, page title and first 50 chars) but no idea how.