List pages with attached image
-
Hello,
I’m trying to create a simple image based page navigation that consists out of
– the page title
– the image attached to the pageand that looped for all the children of a page.
But I just can’t figure it out.
What I have so far is:
<?php echo ' <ul>'; // Get a list of pages $children = get_children('post_type=page&post_parent=26'); // Loop over each page foreach ($children as $child) { // Get the attached image url $thumbnail = wp_get_attachment_url($post->ID); // Print to screen echo '<li class="page_item page-item-'. $child->ID .'"><a>ID .'" href="?page_id='. $child->ID .'"><img src="'. $thumbnail .'">'. $child->post_title .'</a>'; } echo '</ul> '; ?>
Anybody any thoughts?
- The topic ‘List pages with attached image’ is closed to new replies.