让 WordPress 显示每月存档的代码?

发布于 2024-08-16 04:58:39 字数 195 浏览 4 评论 0原文

我们正在工作中设置 WP-MU,我的任务之一是在侧边栏中创建一个链接,该链接将转到显示每月存档的页面。

侧边栏不得包含存档列表,而只能包含指向按月显示存档的页面(由 WP 即时生成)的链接。

这可能很简单,但我花了几个小时浏览 Codex 和博客文章,但没有取得进展。

有人可以帮助我吗?

谢谢你, 弗兰克·卢克

We are setting up a WP-MU at work and one of my tasks is to make a link in the sidebar that will go to a page displaying a monthly archive.

The sidebar must not contain the archive list just a link to a page (generated on the fly by WP) that shows the archive by month.

This is probably simple, but I have spent hours going through Codex and blog posts and not making headway.

Can anyone help me?

Thank you,
Frank Luke

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

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

发布评论

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

评论(1

合约呢 2024-08-23 04:58:39

WordPress Codex:创建存档 应该解释如何生成每月存档页面本身。获取每月存档的模板标签是:

<?php wp_get_archives('type=monthly'); ?>

如果您按照创建存档 您只需在侧边栏模板中添加一个链接(即 sidebar.php):

<a href="/archives.php">Monthly Archives</a>

使用适合您设置的 URI。

WordPress Codex: Creating an Archive should explain how to generate the monthly archive page itself. The template tag to get the monthly archives is:

<?php wp_get_archives('type=monthly'); ?>

If you then have your archives template setup according to Creating an Archive you should only need to add a link as so in the sidebar template (i.e. sidebar.php):

<a href="/archives.php">Monthly Archives</a>

with the appropriate URI for your setup.

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