Skip to content

Instantly share code, notes, and snippets.

@quagliato
Created September 27, 2013 04:44
Show Gist options
  • Save quagliato/6724256 to your computer and use it in GitHub Desktop.
Save quagliato/6724256 to your computer and use it in GitHub Desktop.
Iterate WP pages and create <section> for them
<?php
$pages = get_pages(
array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order',
'post_type' => 'page',
'posts_per_page' => 999
)
);
foreach($pages as $page){
?>
<section id="<?=$page->post_name?>" title="<?=$page->post_title?>">
<div id="left">
<div id="top_img">
<?=get_the_post_thumbnail($page->ID, 'full')?>
</div><!--/top_img-->
</div><!--/left-->
<div id="right">
<?=apply_filters( 'the_content', $page_content );?>
</div><!--/right-->
</section><!--/section-->
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment