1

I want to develop my first Parallax WordPress theme, just for the fun of learning this stuff.

I found this snippet: http://jsfiddle.net/cse_tushar/Dxtyu/141/

It lets the user click on a menu item and the website will scroll to that page. I want to know if it's possible to do this when developing a theme - to somehow get the pages of each menu item on the same front page, and being able to jump straight to it.

This of course means it will have to be functional no matter what page it is from the menu, as I want to distribute the theme to the theme repository.

I hope this makes sense.

1 Answer 1

2

One option would be to load all items in the nav menu into the page when it is being generated using wp_get_nav_menu_items( $menu_name, $args )

Another possible way to do that would be to use ajax to grab the page in question and append it to the end of the current content before the scroll action is fired.

However, there are a few possible problems with the latter idea, particularly the fact that normal wordpress themes use templates to show an entire page ... and getting just the content you want to append would require a little more work than simply receiving query data, using query_posts() to stomp all of the globals (finally, a use for that function!), opening a buffer, loading the appropriate template, and returning the content.

Of course, you could write a custom function to grab and format posts in a particular way and then use that to return the proper code to be appended to the post list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.