• Resolved dwooly824

    (@dwoolworth824)


    I’d like to change the wording of the “Next” and “Previous” links on my portfolio.

    I tried changing the text on the template-tags.php file and uploading that to the inc folder in my child theme, but that didn’t update the text.

    How can I customize the wording on the “Next” and “Previous” links?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Kathryn Presner

    (@zoonini)

    The portfolio archive page uses the general <?php sketch_paging_nav(); ?> so if you change the wording there, it will affect regular blog posts as well. I don’t see a blog on your site, though, so maybe that’s moot?

    What you’d need to do is pull out the paging function and put it in your child theme’s functions.php.

    Tweak My New Previous and My New Next to whatever you’d like.

    function sketch_paging_nav( $max_num_pages = '' ) {
    	// Get max_num_pages if not provided
    	if ( '' == $max_num_pages )
    		$max_num_pages = $GLOBALS['wp_query']->max_num_pages;
    
    	// Don't print empty markup if there's only one page.
    	if ( $max_num_pages < 2 ) {
    		return;
    	}
    	?>
    	<nav class="navigation paging-navigation clear" role="navigation">
    		<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'sketch' ); ?></h1>
    		<div class="nav-links">
    
    			<?php if ( get_next_posts_link( '', $max_num_pages ) ) : ?>
    			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">My New Previous</span>', 'sketch' ), $max_num_pages ); ?></div>
    			<?php endif; ?>
    
    			<?php if ( get_previous_posts_link( '', $max_num_pages ) ) : ?>
    			<div class="nav-next"><?php previous_posts_link( __( '<span class="meta-nav">My New Next</span>', 'sketch' ), $max_num_pages ); ?></div>
    			<?php endif; ?>
    
    		</div><!-- .nav-links -->
    	</nav><!-- .navigation -->
    	<?php
    }

    If you do plan to have a blog and the new wording won’t work for both, it is possible to create a new paging function just for the portfolio, but it’ll require a bit more code. Let me know how it goes and what you’d like to do.

    Thread Starter dwooly824

    (@dwoolworth824)

    Hi Kathryn,

    Thanks for looking into this. I don’t plan to have a blog, so this is a good solution for the portfolio archive.

    Thank you!

    Moderator Kathryn Presner

    (@zoonini)

    You’re very welcome!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change Next/Previous link text’ is closed to new replies.