简体   繁体   English

发布导航代码

[英]Post navigation code

I use this code for navigation in my front page: 我在首页中使用以下代码进行导航:

<h13><div class="navigation">

<div class="next-posts">
    <div id="image_left"><?php next_posts_link('<img src="IMG URL"/>') ?></div>

    <div id="posts_left"><h12><?php next_posts_link('Older Stuff') ?></h12></div>
</div>

<div class="prev-posts">
    <div id="posts_right"><h12><?php previous_posts_link('Newer Stuff') ?></h12></div>

    <div id="image_right"><?php previous_posts_link('<img src="IMG URL"/>') ?></div>
</div>

I want the same navigation for my single post view but I can't get it to work, I made the changes for PHP functions but in Codex I only found a vay to display posts from the same category. 我希望在单个帖子视图中使用相同的导航,但无法正常工作,我对PHP函数进行了更改,但在Codex中,我只发现了一种显示相同类别帖子的方法。 Also, I don't want the link to display previous/next post's title, only text that I define. 另外,我不希望链接显示上一个/下一个帖子的标题,仅显示我定义的文本。 One last thing, I can't get the image navigation to work at all in single view, but it does work flawlessly in my home page. 最后一件事,我无法使图像导航完全在单个视图中工作,但是它确实可以在我的主页上完美地工作。

This is my code at the moment: 这是我目前的代码:

<h13><div class="navigation">

<div class="next-post">
    <div id="img_left"><?php next_post_link('<img src="IMG URL"/>') ?></div>

    <div id="post_left"><h12><?php next_post_link('%link', 'Next post', TRUE); ?></h12></div>
</div>

<div class="prev-post">
    <div id="post_right"><h12><?php previous_post_link('%link', 'Previous post', TRUE); ?></h12></div>

    <div id="img_right"><?php previous_post_link('<img src="IMG URL"/>') ?></div>
</div>

h13 and h12? h13和h12? I didn't know headers went up that high! 我不知道标题上升了这么高!

I'm guessing you already read the Codex Page for the next_post_link() function. 我猜您已经阅读了next_post_link()函数Codex页面。 But did you make sure to include the call in the loop? 但是您确定要在循环中包含该调用吗? Also, try adding in the extra parameters to the functions. 另外,尝试将额外的参数添加到函数中。 Sometimes they get confused. 有时他们会感到困惑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM