WordPress.org

Ready to get started?Download WordPress

Forums

One page theme: pages margin and page order (How to?) (2 posts)

  1. shablon
    Member
    Posted 9 months ago #

    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!

  2. mindctrl
    Member
    Posted 9 months ago #

    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.

Reply

You must log in to post.

About this Topic