get & display custom field data from child pages in table
-
I am trying to get and display the custom field data from the child pages of a particular page ($post_parent => 301;). The idea is to build a table where each row represents a child page, sorted by page_title of each child page.
I need this to display ON the parent page AFTER the_content(); of the parent page in a table structure. I’d like to manually write the first row with <th> elements as the table headings.
I’ve tried many of the examples I’ve read in the forum posts using query_posts() and get_posts() but I cannot figure it out.
Should I first run the main loop displaying the parent page’s title and content, THEN run a new query to get the data from the child pages of the parent page?
If yes, how would I do that? Then, how do I output the table, first row of headers (as headings for the data of each child) and then create a new row for each child’s data contained in its custom fields?
I know how to use c2c’s get_custom() function to return this data for a page (at least when ON that page)… so I was hoping to write each row using something like this for each child page:
<tr> <?php echo c2c_get_custom('Org-Name','<td><strong>','</strong></td>','',''); echo c2c_get_custom('Services-Categories','<td>','</td>',' ','</td><td>','</td>'); ?> </tr>
There are so many examples but they seem mostly used to generate a list of the child pages rather than access each child’s custom field data.
Ideas? Examples?
- The topic ‘get & display custom field data from child pages in table’ is closed to new replies.