• Hello all,
    I’d like to build a one-page website. I have built 5 pages each one has its own php file. How can I do to concatenate the 5 pages in one single page?
    Thank you in advance for your help,
    Fabiana

Viewing 5 replies - 1 through 5 (of 5 total)
  • If all you want is a single page, why create 5 pages? Why not just create a Home page that has all that info on it.

    Thread Starter webento

    (@webento)

    Dear TrishaM,
    thank you for your reply. I need 5 different pages because I have 5 different layout pages (with their own classes, ids,etc…), so I can not put everything in one page.
    Fabiana

    Fabiana,

    Have you found an answer for your question? I think we have the same problem: I want to build a one-page layout.

    Actually, the design is simple:

    = MENU =
    ————-
    PHOTO SLIDER
    =============
    A PAGE
    =============
    AN OTHER PAGE
    =============
    PHOTO BLOG
    POST
    ——-
    OTHER BLOG
    PHOTO POST
    =============
    SIDEBAR
    =============

    I started to manipulate _s (https://underscores.me/) framework and change INDEX.PHP to this:

    <?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
    } ?>
    
    <?php if ( have_posts() ) : ?>
    
    			<?php /* Start the Loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    
    				<?php
    					/* Include the Post-Format-specific template for the content.
    					 * If you want to override this in a child theme, then include a file
    					 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    					 */
    					get_template_part( 'content', get_post_format() );
    				?>
    
    			<?php endwhile; ?>
    
    			<?php the_posts_navigation(); ?>
    
    		<?php else : ?>
    
    			<?php get_template_part( 'content', 'none' ); ?>
    
    		<?php endif; ?>
    
    <?php
    
    get_sidebar();
    get_footer();
    ?>

    Now I’m working with CSS to format and position the text, change fonts and colors, etc.

    If you have any information or reference to help me, I appreciate.

    Saúde!
    m.

    Thread Starter webento

    (@webento)

    Dear Marco,
    I solved the problem keeping each page apart. I included them into the homepage as follow:

    get_header(); ?>
    
    		<?php get_template_part( 'your page' ); ?>
    
    		<?php get_template_part( 'your page'  );?>
    
    		<?php get_template_part( 'your page'  ); ?>
    
    		<?php get_template_part('your page'  );?>
    
    <?php get_footer(); ?>

    Remove from each page the header and the footer, leaving only the loop.
    Hoping this help!
    Fabiana

    Fabiana,

    Thanks!

    Actually, your code is more simple. You just call the pages, one by one. In my code, I tried to call every page created and after I call the blog.

    Thank you very much, anyway!

    Saúde!
    m.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘one-page with different php pages’ is closed to new replies.