Displaying content from many pages on home page
-
I’m modifying twentyeleven showcase template and got stuck in one place.
What I’m trying to achieve is to have a horizontal bar under the banner containing the Intro, showcase slideshow and contact form – this part works.
Underneath this I want to display several boxes with content coming from other static pages, and simply can’t get it to work the way I want.
I’m using the following code to call the pages:<?php $mypages = get_pages( array( 'sort_column' => 'post_date', 'sort_order' => 'desc' ) ); foreach( $mypages as $page ) { $content = $page->post_content; if ( ! $content ) // Check for empty page continue; $content = apply_filters( 'the_content', $content ); ?> <article id="post-<?php the_ID(); ?>" <?php post_class( 'more' ); ?>> <h1><a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h1> <div class="entry-content"><?php echo $content; ?></div> </article> <?php } ?>
This is actually taken from the get_pages codex, with removed
child_of
parameter and adjusted containers. How can I specify just a few pages to be displayed? Right now all the pages are displayed. If I leave thechild_of
no pages are displayed in turn.Thanks for help.
- The topic ‘Displaying content from many pages on home page’ is closed to new replies.