• i’m working on a one page theme. Here is the code i use to get all of the pages to display on one page

    `<?php $pages = get_pages();
    foreach ($pages as $page_data) {
    $content = apply_filters(‘the_content’, $page_data->post_content);
    $title = $page_data->post_title;
    $slug = $page_data->post_name;
    echo “<div class=’$slug’>”;
    echo “<h2>$title</h2>”;
    echo $content;
    echo “</div>”;
    }
    ?>
    No problem there

    Two questions I have are

    1)How do i get to display pages in certain order? I tried setting up order in admin panel, but it didn’t work at all

    2)How do i set up margins between these pages?

    Thank you!

Viewing 1 replies (of 1 total)
  • get_pages takes arguments for sorting. Check out sort_order and sort_column.

    To get margins, just add an extra class to the wrapping div and add the appropriate CSS.

Viewing 1 replies (of 1 total)
  • The topic ‘One page theme: pages margin and page order (How to?)’ is closed to new replies.