为 twentyeleven 的导航添加标题

发现 WordPress 的 twentytwelve 主题在单个文章页面的上下篇文章导航的时候会给出文章的标题,而 twentyeleven 却只是简单的写着 Previous 和 Next,于是本着拿来主义的精神,把那个导航移花接木了过来,在 WordPress 的后台的 Appearance 里面的 Editor 中,选择 twentyeleven 的 single.php 文件,把导航部分修改成如下,(注释的部分是原来的),然后保存即可

					<nav id="nav-single">
						<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
						<?php /*<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">&larr;</span> Previous', 'twentyeleven' ) ); ?></span>
						<span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?></span>
						*/ ?>
						<span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentyeleven' ) . '</span> %title' ); ?></span>
						<span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentyeleven' ) . '</span>' ); ?></span>
					</nav><!-- #nav-single -->

Leave a Reply

Your email address will not be published. Required fields are marked *