Wordpress 侧边栏中的持久帖子名称

发布于 2024-09-10 09:16:04 字数 156 浏览 2 评论 0原文

我需要始终在我的 WordPress 主题的侧边栏中显示我的所有帖子标题。现在它仅在我浏览类别时才有效(它显示该类别的所有帖子标题)。但是,当我单击帖子时,只有该帖子标题保留在我的侧边栏中,而侧边栏不应该具有这样的功能。

你能帮我一下吗?

预先非常感谢您! 赫里斯托

I need to display all my post titles in the sidebar of my Wordpress theme all the time. Just now it works only when I am browsing a category (it shows all post titles from that category). But when I click on a post, only this post title remains into my sidebar, which is not supposed to function like that.

Could you help me, please?

Thank you very much in advance!
Hristo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

方圜几里 2024-09-17 09:16:04

如果您能够自己编写一个插件,使用 WordPress 的 API 这非常容易,您可以为自己制作一个小部件,使用 the_loop() 函数打印所有帖子标题。

如果您制作了自己的主题,您甚至可以将其集成到您的functions.php 文件中,然后在侧边栏模板中输出标题。

要从数据库查询帖子,您将需要 query_posts() 函数,您也可以在其中过滤您帖子的某些字段。

If you are able to write a plugin yourself, which is quite easy using the API of WordPress, you can make yourself a widget that uses the the_loop() function to print out all post titles.

If you have made your own theme, you can even integrate it into your functions.php file and then output the title within your sidebar template.

To query the post from the database you will need the query_posts() function, where you can also filter on some fields of your posts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文