WordPress.org

Ready to get started?Download WordPress

Forums

remove top before -next nav but Keep bottom twentyten (5 posts)

  1. dragonsjaw
    Member
    Posted 2 years ago #

    child of twentyten:

    So I don't want the top before and next navigation on single.php
    I take this

    <?php /* Display navigation to next/previous pages when applicable */ ?>
    <?php if ( $wp_query->max_num_pages > 1 ) : ?>
    	<div id="nav-above" class="navigation">
    		<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
    	</div><!-- #nav-above -->
    <?php endif; ?>

    out of the loop - call the page loop-single.php
    and all seems good...
    BUT there now is no bottom before and next navigation either?? Weird.

    I try adding the bottom nav

    <?php /* Display navigation to next/previous pages when applicable */ ?>
    <?php if (  $wp_query->max_num_pages > 1 ) : ?>
    				<div id="nav-below" class="navigation">
    					<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
    					<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
    				</div><!-- #nav-below -->
    <?php endif; ?>

    directly to single.php and that doesn't pull it in either.

    I am confused. Why? Help?

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Um - shouldn't you be creating a custom version of loop-single.php in your child theme? The code you quoted is from loop.php.

  3. dragonsjaw
    Member
    Posted 2 years ago #

    Well I thought that was what I had done.
    I took the top nav part off of the loop and then made a file called loop-single.php in the child theme.

    It did take off the top nav..but also took off the bottom next-pre nav,
    even though that was still there in loop-single.php.

  4. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    the codes that you are showing, are for multipost pages, such as archives and the front page (see the s in next_posts_link ?)

    for the single post, it is this code:

    <div id="nav-below" class="navigation">
    					<div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentyten' ) . '</span> %title' ); ?></div>
    					<div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentyten' ) . '</span>' ); ?></div>
    				</div><!-- #nav-below -->

    from loop-single.php of the original Twenty Ten.

    http://codex.wordpress.org/Function_Reference/next_post_link
    http://codex.wordpress.org/Function_Reference/previous_post_link

  5. dragonsjaw
    Member
    Posted 2 years ago #

    Thank you alchymyth.. it's always the little things like an 's'..LOL
    I've got it working now, thanks to you.

Topic Closed

This topic has been closed to new replies.

About this Topic