Skip to content

Instantly share code, notes, and snippets.

@brojask
Created September 7, 2015 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brojask/ef9335e4b5075d085fd6 to your computer and use it in GitHub Desktop.
Save brojask/ef9335e4b5075d085fd6 to your computer and use it in GitHub Desktop.
Single Page for Wordpress Theme
<?php
get_header();
?>
<div id="container">
<a name="top"></a>
<?php
$args = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order', //post_title
'hierarchical' => 1,
'exclude' => '',
'child_of' => 0,
'parent' => -1,
'exclude_tree' => '',
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
//start loop
foreach ($pages as $page_data) {
$content = apply_filters('the_content', $page_data->post_content);
$title = $page_data->post_title;
$slug = $page_data->post_name;
?>
<div class='<?php echo "$slug" ?>'><a name='<?php echo "$slug" ?>'></a>
<h2><?php echo "$title" ?></h2>
<?php echo "$content" ?>
</div>
<?php
}
get_footer();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment