Post Parent problem?
-
Hello.
Right now I’m making a sidebar.php and i’m so confused about getting a sub page shows in their parent page. This is my code :
<?php /** * The Sidebar containing the primary and secondary widget areas. * * @package WordPress * @subpackage Ultimate_smart * @since Ultimatesmart */ ?> <!-- begin sidebar --> <div class="grid_4"> <div class="inner_sidebar"> <?php if (is_single() || is_archive() || is_page('journal')) { ;?> <h2>Recent Post</h2> <?php query_posts('showposts=6'); ?> <div class="rpost"> <?php while (have_posts()) : the_post(); ?> <ul> <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Go to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul> <h2>Categories</h2> <?php wp_list_categories('title_li='); ?> <?php } elseif (is_page()) { ?> <?php $page_query = new WP_Query('post_type=page&post_parent='); ?> <?php while ($page_query->have_posts()) : $page_query->the_post(); ?> <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a> <?php get_the_image( array ( 'width' => '80', 'height' => '80' ) ); ?> <?php the_excerpt(); ?> <?php endwhile; ?> <?php } ?> </div> </div> <div class="clear"></div><!-- END SIDEBAR -->
I know the problem is the post_parent (or maybe something else?). If i set the post_parent=ID’ it worked but it only shows that page ID on all pages .
Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Post Parent problem?’ is closed to new replies.