I am trying to build a single page wordpress theme. I've been able to display all my pages content on one page and scroll between it using menu items. Now I want to add the <?php post_class(); ?>
to each of my page sections so they show the proper wordpress classes.
Here is my php that outputs all of the page contents into one page,
<?php $pages = get_pages(array('sort_column' => 'menu_order'));
foreach ($pages as $page_data) {
$content = apply_filters('the_content', $page_data->post_content);
$slug = $page_data->post_name;
$class = post_class('content_wrapper');
echo '<div id="' . $slug . '" class="' . $class . '">';
echo $content;
echo '</div>';
}
?>
There are 2 issues with this code that I can't seem to resolve:
1) This code just outputs the same class for each page, not different classes for each page
2) The class is just outputted into my raw HTML so is visable on my site - it's not adding into where i've written class="' . $class . '">';