2013-05-20 97 views
0
<?php if (is_single()) {?> 
    <div class="post-prenex"> 
<div class="alignleft"> 
<?php previous_post('&laquo; &laquo; %', 
'Previous Post ', 'no'); ?> 
</div> 
<?php ?> 
<div class="alignright"> 
<?php next_post('% &raquo; &raquo; ', 
'Next Post ', 'no'); ?> 
</div> 
</div> 

<?php }?> 

大家好我试过简单的插件作为下一个和以前的帖子。在接下来的和以前的文章工作正常。但是帖子中的内容已经消失了。 我不知道我犯了什么错误。 注:我没被ADD_ACTION编辑的single.php文件,我想the_content发布内容在使用下一篇文章和以前的文章时不显示。

任何一个点出了问题,并给出解决方案大加赞赏。

回答

1

,我看到了一些问题:

  • previous_post()和next_post()已被弃用
  • 与the_content行动工作时,函数必须返回实际内容

function mycontent($content) { 
    $output = ''; 
    // add something to output 
    return $content.$output; //return content with output 
} 
add_action('the_content', 'mycontent'); 
  • 文章/页面导航标签是应在模板文件中使用的模板标签
相关问题