List supages with thumbnails
-
Hey there,
Hoping someone can help me figure out the best way to do this.
I’m looking to display subpages in the main content area of a parent page the same way that I display posts:
clickable title, excerpt and “featured image” thumbnail.
To create the exerpt data I’m using this plugin:
http://wordpress.org/extend/plugins/pjw-page-excerpt/
And to generate the exeprt and titles I’m using this code:
<?php $pageChildren = get_pages('child_of='.$post->ID.''); if ( $pageChildren ) { foreach ( $pageChildren as $pageChild ) { echo '<h2><a href="' . get_permalink($pageChild->ID) . '">'. $pageChild->post_title.'</a></h2> '; if ($pageChild->post_excerpt){ echo ''.$pageChild->post_excerpt.' '; } } } ?>Which I found here:
http://wordpress.org/support/topic/display-title-and-except-of-sub-pages?replies=12
I’d like to add the post-thumbnail and I’d also like to be able to limit the depth if needed.
-
It seems I could limit the depth to just children, not grandchildren, by using this parameeter:
exclude_tree
(integer) The opposite of ‘child_of’, ‘exclude_tree’ will remove all children of a given ID from the results. Useful for hiding all children of a given page. Can also be used to hide grandchildren in conjunction with a ‘child_of’ value. This parameter was available at Version 2.7.But I am unsure as to how that should be implemented.
http://codex.wordpress.org/Function_Reference/get_pages
So I’e hit a wall there but hopefully someone can help me out, working on the thumbnail next.
Here’s what I ended up with, last thing t do is figure out how to call the small image instead of the thumbnail.
[Code moderated as per the Forum Rules. Please use the pastebin]
The topic ‘List supages with thumbnails’ is closed to new replies.