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

Landing Page WP Theme

Hello, I need some advices here. I took the course html to WP Theme and now I would like to convert a one page (landing) html site into a WordPress Theme. What is the best way to show each section of the landing in the admin area? How would you solve it?

6 Answers

Andrew McCormick
Andrew McCormick
17,730 Points

Not entirely sure what you are looking for, but assuming that you mean you want to have a separate field for each of your sections on the edit page screen, then you could use Custom Fields on your pages and then display those in a custom template for your landing page. the codex- custom fields

If I have a landing page with different section:

  1. Header
  2. Testimonials
  3. Contact us

Do I have to create one single php file? Each section will be a custom field? Each section will be a template?

Haneen Krimly
PLUS
Haneen Krimly
Courses Plus Student 29,322 Points

What you can do is create a page template, say "page-landing.php", and code it as you would a normal page. Then add some custom fields for the testimonials and maybe a widget area for the contact form.

I would guess that your starting point would be to duplicate your current "page.php", and then adding some custom fields for the testimonials in your WP admin area, and add the code for the testimonials custom fields. Then you go into your "functions.php" and create a new widgetized area for your landing page template. This should work fine with contact form plugins that use shortcodes.

As for the header, since it's a regular page but with a custom template, you can just use the title of the page (in the admin area) as the header, so it would be dynamic.

I hope that helped!

Anthony Hind
Anthony Hind
5,715 Points

Its also possible to use the <?php get_template_part( 'content' ); ?> function so you can create different sections of code and pull them into your front-page.php

the link below might help on this, link

Thanks! I will try it.

How can I mix a menu with links to each section of the page and links to a new page (like the news).

Links to sections are:

  1. Home 2.Testimonials 3.Contact Link to a new page:
  2. News -----> blog page

Do I need to set something in the functions file?