Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Post Nav/Pagination Not Showing #820

Closed
robertrhu opened this issue May 17, 2016 · 10 comments
Closed

Post Nav/Pagination Not Showing #820

robertrhu opened this issue May 17, 2016 · 10 comments

Comments

@robertrhu
Copy link

As always, thank you so much for FoundationPress. Its my favorite!

For some reason I am unable to get next and previous pagination navigation to appear on the bottom of my single-*.php pages. This usually works out of the box but not working for me this time. Previous and next links don't appear on my posts.

I haven't changed anything in the functions.php pagination function.

Here's what I've using in my single-*.php files...

//CODE I'M USING ON MY SINGLE PAGES

<?php /* Display navigation to next/previous pages when applicable */ ?>
        <?php if ( function_exists( 'foundationpress_pagination' ) ) { foundationpress_pagination(); } else if ( is_paged() ) { ?>
            <nav id="post-nav">
                <div class="post-previous"><?php next_posts_link( __( '&larr; Older posts', 'foundationpress' ) ); ?></div>
                <div class="post-next"><?php previous_posts_link( __( 'Newer posts &rarr;', 'foundationpress' ) ); ?></div>
            </nav>
        <?php } ?>
@joewellmade
Copy link

Hi, I also can't get the pagination to work on single.php.

@ghost
Copy link

ghost commented Jun 9, 2016

Hello folks, there seems to be slight confusion what kind of navigation should appear and where.

The single.php is equipped with wp_link_pages function:
https://codex.wordpress.org/Function_Reference/wp_link_pages

I agree single.php should contain previous_post_link and next_post_link function:
https://codex.wordpress.org/Function_Reference/previous_post_link
https://codex.wordpress.org/Function_Reference/next_post_link

The snippet @robertrhu suggests is meant to be used only on archive templates.

@joewellmade
Copy link

Hi Eccola, here's my template code, do you know why I can't get pagination to show here?

`

<div class="row">
    <div class="large-6 large-offset-3 columns post-box">
        <?php do_action( 'foundationpress_before_content' ); ?>
        <?php if ( have_posts() ) : ?>
        <?php while ( have_posts() ) : the_post(); ?>
            <article <?php post_class('main-content') ?> id="post-<?php the_ID(); ?>">
                <header>
                    <h1 class="entry-title"><?php the_title(); ?></h1>
                    <?php foundationpress_entry_meta(); ?>
                </header>
                <?php do_action( 'foundationpress_post_before_entry_content' ); ?>
                <div class="entry-content">

                <?php
                    if ( has_post_thumbnail() ) :
                        the_post_thumbnail('large');
                    endif;
                ?>

                <?php the_content(); ?>
                </div>

                <footer>
                    <?php wp_link_pages( array('before' => '<nav id="page-nav"><p>' . __( 'Pages:', 'foundationpress' ), 'after' => '</p></nav>' ) ); ?>
                    <p><?php the_tags(); ?></p>
                </footer>

            </article>


        <?php endwhile;?>


        <?php else : ?>
            <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
        <?php endif; ?>



        <?php do_action( 'foundationpress_after_content' ); ?>
    </div>
</div>
`

@ghost
Copy link

ghost commented Jun 14, 2016

@joewellmade, what FP version you are using?

Try paginating your single post content:

Post Page 1 Content

<!--nextpage-->

Post Page 2 Content

<!--nextpage-->

Post Page 3 Content

@joewellmade
Copy link

joewellmade commented Jun 15, 2016

Thanks, much appreciated, I have it working now. I just added:
<?php previous_post_link(); ?> <?php next_post_link(); ?>

@colin-marshall
Copy link
Collaborator

@eccola you think we should add the previous_post_link() & the next_post_link() to FoundationPress on single.php? I'm all for adding it, if others think so too.

Anybody else have an opinion on adding this? @olefredrik @Aetles?

@olefredrik
Copy link
Owner

I'd say yes.

@Aetles
Copy link
Contributor

Aetles commented Jun 28, 2016

Isn't that what the_post_navigation() does? It's already in single.php. Or am I misunderstanding the questing here?

(Whenever I am in doubt I usually check what Underscores are doing and they are using the_post_navigation() in their single.php and no sign of previous_post_link() or next_post_link().)

@colin-marshall
Copy link
Collaborator

@Aetles thank you, that is correct. I only read this thread and should have looked at the theme first.

@robertrhu is <?php the_post_navigation(); ?> present in your single-*.php?

@ghost
Copy link

ghost commented Jun 29, 2016

@colin-marshall , see: #839

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants