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

Jaco Burger
Jaco Burger
20,807 Points

One Page site widget areas

Hi Guys

I'm building a one page WP site, as explained in the workshop by Zac. I understand the loop structure, but I need a way to add widget areas only to certain "sections".

Any idea how I can go about it?

Thanks!

3 Answers

Hi Jaco,

Just to be clear, you want to display your custom registered widgets in certain areas within your page, but you don't have any sidebars registered, Is that right?

If so, the_widget(); (http://codex.wordpress.org/Function_Reference/the_widget) is what you looking for.

Dan Barrett
Dan Barrett
10,450 Points

I hope I am no hijacking this post but I am facing a very similar problem but really struggling to get a second pair of eyes on the problem. Mine is to do with the sidebar - I have created the functions within funtcions.php and they show in the admin area as available widget areas but the if statements are failing but they are exactly to how Zac has shown in the video.

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

You should open a new forum post for this and include all the relevant code examples.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

You will likely have to use multiple loops in this case and insert the widget code between the loop.

Jaco Burger
Jaco Burger
20,807 Points

Thanks Zac! Mind giving an example of such a loop? :)