Skip to main content
Snippets

Change the Twenty Fourteen Next / Previous Post Text

By March 24, 2016No Comments

I’m working on a website using a child-theme of Twenty Fourteen and the “Previous / Next Post” verbiage isn’t appropriate for this website. The word “Post” should be more relevant to the websites purpose; an online store of sorts.

The piece of code that I needed to change was located in the parent theme directory inc/template-tags.php from line 68 through 99. Copying this to the child theme was ineffective. The solution I ended up with was written to the child themes functions.php. I changed “Post” to “Product.” Lastly, I wanted a product listed in a category to show next and previous links within it’s parent category. I found all of what I needed in the WordPress Codex – http://codex.wordpress.org/Function_Reference/previous_post_link

// Change Previous / Next Text
 
if( ! function_exists(twentyfourteen_post_nav) ) { function twentyfourteen_post_nav() { 

	echo '<nav class="navigation post-navigation" role="navigation">
			<div class="nav-links">';
							previous_post_link( '%link', __( '<span class="meta-nav">Previous Product</span>%title', 'twentyfourteen' ), true );
							next_post_link( '%link', __( '<span class="meta-nav">Next Product</span>%title', 'twentyfourteen' ), true );
	echo '</div><!-- .nav-links -->
		</nav><!-- .navigation -->';
}}

Pretty simple.

Contact us to learn more about Adopt the Web for your business

Author Jarod Thornton

More posts by Jarod Thornton