[英]WordPress How to output next post and previous post with custom name?
I am using twenty twelve theme ,and i am trying to output Next post and Previous Post at the bottom of inner page. 我正在使用二十二个主题,并且尝试在内部页面底部输出下一个帖子和上一个帖子。
The thing is this function outputs the post title and 2 arrows like this : Remaining essentially unchanged » 问题是此函数输出帖子标题和2个箭头,如下所示: 基本上保持不变»
<?php next_post_link(); ?>
What I am trying to achieve is to have only < Previous Post - Next Post > . 我要实现的是仅具有<Previous Post-Next Post> 。
Can anyone help me out with this one ? 谁能帮我解决这个问题?
Thank you. 谢谢。
You can add a formater and link text arguments to your code. 您可以添加格式化程序并将文本参数链接到您的代码。
previous_post_link( '< %link', 'Previous Post');
next_post_link( '%link >', 'Next Post');
Something like that should work for you. 这样的事情应该为您工作。
You can customize the link text by passing it as the second parameter. 您可以通过将链接文本作为第二个参数传递来自定义链接文本。
<?php next_post_link( '%link', 'Link Text Here' ); ?>
So in your case, your next link would be 因此,在您的情况下,您的下一个链接将是
<?php next_post_link( '%link', 'Next Post >' ); ?>
You can do the same with prev_post_link(). 您可以使用prev_post_link()执行相同的操作。
Further reading: https://codex.wordpress.org/Function_Reference/next_post_link 进一步阅读: https : //codex.wordpress.org/Function_Reference/next_post_link
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.