Query category on parent page
-
I am trying to do something which i thought would be simple but isn’t turning out so.
On a parent page i want to show the thumbnail and title of a child page (which i have been able to do). The problem is that there are two types of child page and i want to show them separated on the page e.g.
Current exhibitions:
(thumbnail)
page 1Previous exhibitions:
(thumbnail) (thumbnail)
page 1 page 2I thought if i added a category then i could just if category = show these pages if not etc but i can’t get it to work. Is this something that your plugin can do or am i going about it the wrong way. Wanted to post here before i throw it out to general wordpress forums. This is the code i am using:
<?php $mypages = get_pages( array( 'cat'=> '3', 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) ); foreach( $mypages as $page ) { ?> <?php echo get_the_post_thumbnail( $page->ID ); ?> <h2><a href="/<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h2> <?php } ?>
http://wordpress.org/plugins/post-tags-and-categories-for-pages/
- The topic ‘Query category on parent page’ is closed to new replies.