Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to create an one page template [ w/out infinite scroll ]. The two problems I'm running into are adding a class to the list pages function [ or finding some other way to target the menu for smooth page scrolling ] && dynamically loading each page inside of a section or div all on one page.

Any thoughts?

share|improve this question
    
So you want a twitter-esque page where as you scroll down it loads more posts? –  Sterling Hamilton Feb 14 '12 at 18:13
add comment

1 Answer

up vote 1 down vote accepted

I understand now!

You just need to figure a way to programmatically generate sections of code with anchors and have your main menu link to those anchors!

<?php
    $args = array(
        'post_type' => array( 'page' ),
        'post_status' => array( 'publish' ),
        'orderby' => 'menu_order',
        'order' => 'asc'
    );
    query_posts( $args );

    if (have_posts()) : while (have_posts()) : the_post();
?>
        <section id="<?php the_permalink(); ?>">
            <?php the_content(__('(more...)')); ?>
        </section> 
<?php endwhile; else: ?>
    <p>Sorry, no pages matched your criteria.</p>
<?php endif; ?>

For the menu you can do this:

http://codex.wordpress.org/Function_Reference/wp_nav_menu

http://codex.wordpress.org/Function_Reference/wp_page_menu

http://codex.wordpress.org/Function_Reference/wp_list_pages

We need to figure out how to get the permalink or ID for the pages from wp_list_page... we need a walker!

http://www.hashbangcode.com/blog/extending-wordpress-page-walker-518.html

I would recommend posting a new question at this point.

"How do I write a Walker for wp_list_pages for permalink URLs."

You're basically trying to replace the WordPress generated URLs with anchor tags.

share|improve this answer
    
I've used Infinite Scroll before // The only problem is that I want to load multiple pages, not multiple posts // I was originally thinking of having the blog page load last && then using Infinite Scroll to continue to load pages // I was able to hard code each page in, but I need it to be dynamic for clients. –  flash Feb 14 '12 at 18:38
    
Sounds like some usability design comes into play here. Logically how does a user scroll through pages and then transition into scrolling posts? I think the concept works fine with one or the other, but both could cause some issues. If you were going to exclude posts and just do pages, You could modify infinite scroll to do that pretty easily. In WordPress everything is a post. Just different meta information. –  Sterling Hamilton Feb 14 '12 at 18:40
    
Any ideas on using Infinite Scroll to grab pages && display them in order ? –  flash Feb 14 '12 at 18:46
    
Updated the answer. –  Sterling Hamilton Feb 14 '12 at 19:02
1  
@kaiser // did that (: –  flash Feb 14 '12 at 22:51
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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