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

JavaScript One Page WordPress Site

Getting back to one-page-site homepage page section from a single portfolio piece page, using the nav a js scroll navbar

Hello,

I'm creating a portfolio site using this one-page-site WordPress concept. I've gone through the workshop and created a version of this one-page-site with page sections of 'bio', 'portfolio', and 'contact'.

I've customized the WP_QUERY to only show the 'bio', 'portfolio', and 'contact' pages on the homepage. I've created a page for each single portfolio piece, and those are not shown on the homepage, only as links under the 'portfolio' page section.

This works great, however, the single portfolio pieces use the same navigation bar with nav a hrefs of '#bio', etc. And those are not located on the single portfolio piece page, so the links are broken and I cannot get back to the 'bio' section. So I've manipulated the custom menu link to 'url/#bio' (not sure if that is the appropriate way to do it) and it takes me back to the one-page-site homepage 'bio' section, but the JS scroll does not work anymore. Since the JS scroll function is getting the link variable, I thought it would still work, but it doesn't.

Is there a way to appropriately name the custom menu link url to get back to the one-page-site homepage from a single portfolio piece page while also having the JS scroll work? I hope this makes sense.

Thank you!

Ismar Uzeirovic
Ismar Uzeirovic
1,762 Points

Hi Karissa!

Did you manage to make this work? I am in the process of making a similar website and I think I may encounter the same problem.