Best way to develop a single page theme SOLVED

Hi Everybody,

I´m a big fan of roots and use it for all my wordpress projects.
I recently got a project for a single page site and wanted to know if somebody has any experience with roots. My initial idea was on the static main page, loop all published pages and include the respective templates. Any thoughs? anybody knows any best practice?

Any help is more than appreciated!

Hi, so nobody had an answer for this.

I don´t know if this is the best solution, but it works for me just fine.
The code below is my base.php. Each page has its own Template.

<?php get_template_part('templates/head'); ?>
<body <?php body_class(); ?>>

  <!--[if lt IE 8]>
    <div class="alert alert-warning">
      <?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'roots'); ?>
    </div>
  <![endif]-->

  <?php
    do_action('get_header');
    // Use Bootstrap's navbar if enabled in config.php
    if (current_theme_supports('bootstrap-top-navbar')) {
      get_template_part('templates/header-top-navbar');
    } else {
      get_template_part('templates/header');
    }
  ?>

  <div class="wrap" role="document">
    <div class="content row">
      <main class="main <?php echo roots_main_class(); ?>" role="main">
        <?php 
            global $post;
            $args = array('post_type'=>'page' );
            $myposts = get_posts( $args );
            foreach( $myposts as $post ) :
                setup_postdata($post);
                $template_name = str_replace(array('template-', '.php'), '', get_post_meta( $post->ID, '_wp_page_template', true ));
                get_template_part('template', $template_name);
            endforeach; 
            wp_reset_postdata(); ?>
        <!--?php include roots_template_path(); ?-->
      </main><!-- /.main -->
    </div><!-- /.content -->
  </div><!-- /.wrap -->

  <?php get_template_part('templates/footer'); ?>

</body>
</html>

The result is a list of all my pages with their respective layouts. I would like to know what you think about this approach.

cheers!

Looks good as long as it’s working! Fairly simple so you can’t go too wrong.

I would check if your page is being indexed by search engines the way you want. For example if Google might index the pages as individual pages that people might surf to. By themselves the content might look strange. I have seen this. Some people do this on purpose, some don’t realize this is happening.

Thanks to both, I will definitely check the page stats when is online. The pages being looped are all developed as single entities, so to make the site work as usual (multi page) I would only have to comment the new block and uncomment include roots_template_path()
could even be a “if else” statement.