So I’m new to WordPress, and Im creating a custom theme. I have a custom home page, a blog page which includes a dynamic preview area of the latest 5 blogs, and some other miscellaneous pages. Im trying to design an “events” page where the main page has a sidebar that looks like this:
You can then click on each section, which will open up and have a brief description of the event taken from the page with a read more link to go to that page.
So I have a parent page called “Events Main” and then I have some test pages set up as child pages of the “Events Main” page.
Im a complete beginner at PHP and I was wondering how I could go about querying child pages to fill in that content dynamically.
Im currently using this code `<?php
$page_id = 85;
$page_data = get_page( $page_id );
$content = $page_data->post_excerpt;
$title = $page_data->post_title;
but I have to go in and fill the page id number for each section. I need it to automatically populate these fields, so whenever a new child page is added it will show up.
- The topic ‘Query Pages and post excerpts dynamically’ is closed to new replies.