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

Onepage website in wordpress

Hello fellow treehouse members.

I got an external project and my "customer" wants to have a website where he can adjust and manage the content as much as possible all by himself. So I guess wordpress would be the best choice for this?

I just can't seem to find out how I should create a onepage website in wordpress without installing theme's with basic adjustments available. I rather start from scratch and create my own.

Does anyone know how I can approuch this in the most practical way?

1 Answer

Ash Scott
Ash Scott
435 Points

Hi There Aurelio Decock,

You can do this by creating your own theme. First of all, head over to the Underscores website and generate your starter theme. This is what you can use for the theme. It's all the basic code needed for a fully functioning WordPress theme. Load in the WP Starter SASS and get compiling!

You can then style the theme as required. I would advise creating a custom page template for the homepage (In case they want to move away from one page later) and add custom fields to the homepage. I recommend ACF Pro for this, as it will give you easier customisation ability, and it will make it much easier for the client to manage. You could also look at including Visual Composer so the client can build the page themselves.

If you need any help and/or advice with this, let me know and I'll happily help!

Good luck! Ash

Ash Scott
Ash Scott
435 Points

Hey there!

No problem, happy to help :)

Have you compiled the SASS? (I normally compile it to /css/main.min.css) If so, the easiest way to include it is to:

  1. Remove all the CSS from style.css, but leave the comments at the top
  2. Import the CSS compiled from SASS into style.css (@import: "css/main.min.css";). This saves you from enqueueing it, and saves on additional resources on page load.

Once that's done, you have the theme ready to go, just activate it.

Now, duplicate page.php and name it tpl-homepage.php (The file name doesn't matter, this is just what I use for readability). Once that's duplicated, remove the comment at the top of the file, and replace it with this:

/*
* Template name: Homepage
*/

Before the loop put an <h1> with some random text so you can check the template has been loaded later on.

Now create a new page in WordPress and on the right under the publish button in 'Page Attributes', change the page template to 'Homepage'. If you can't see this dropdown, click screen options at the top right, then check the 'Page Atrributes' tick box. Now set the page template.

Once done, go to 'Settings' > 'Reading'. Set the front page to homepage, and hit save.

Now go to the front end of the site, and see if the <h1> you added earlier is there. If it is, then you can move onto the ACF or VC setup. VC would probably be best, and for the price, it's a bargain. Another one I've seen a lot of lately is Beaver Builder. Looks much better than VC, but I've not used it.... Yet ;)

Let me know if you need any more help and I'll assist happily - If I can empower people with my knowledge, then I'm a happy man :)

Kind regards, Ash

Hey and thank you again Ash!

So I compiled the sass but I don't know if I want to go for the VC way of creating the website. Does it save me a lot of time or does the setup take as much time as I would code it myself? Since I don't have any experiance with VC it will take me longer to create the site anyway.

Ash Scott
Ash Scott
435 Points

Seeing as you've not used VC before, would be easier and quicker to code it yourself. For them to customise it, use ACF to add in the custom fields for them to customise the content of each section. ACF is very easy to use as you're doing basic stuff, but it can get trickier when doing more advanced stuff with it :)

Just so you know, Visual Composer allows you to build the page with columns and what not. It gives the user a visual tool for it, but all it does is adds loads of custom shortcodes in the WYSIWYG editor which WP then interprets. It will display it wherever you have the_content(); in your template. For a client it's cool as they can add loads of different modules, but for a developer like you and I, it's a pain in the a$$!

Good luck. Ash

Thank you Ash for your advice! Most of the website is now completed I just need to fix some styling + adding the real content and the site will be ready for launch.

Thank you very much for helping and advising, I used Visual Composer and it made the job so much easier! Big up for you mate!

Ash Scott
Ash Scott
435 Points

I'm glad you picked up VC quickly - and well done on getting the page sorted! I'm glad to have helped :)