Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Gian Nicola Caggiano
Gian Nicola Caggiano
11,898 Points

How to create a one page themesin wordpress

Hi to all! I just finished to follow the "how to build a wordpress theme" course, that is set up for building a multipage portfolio. But if I want to create a one page portfolio, what is the best practice to do this? Thanks!

3 Answers

I agree with Zac, so your front-page.php would be like; 8 <?php get_header(); ?>

<div class="container">

    <?php get_template_part( 'content', 'featured'); ?>
    <?php get_template_part( 'content', 'text-block'); ?>
    <?php get_template_part( 'content', 'product-block'); ?>
    <?php get_template_part( 'content', 'call-to-action'); ?> 

</div>

<?php get_footer(); ?>

Your would then have the file content-featured.php with the loop and styling for that section, and so on for the other sections.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Just use multiple loops on one page :)

I would suggest separating each section into individual include files.

Gian Nicola Caggiano
Gian Nicola Caggiano
11,898 Points

gosh! it's so simple! Thanks Zac, and thanks Nazim for your detailed example.