在 WordPress 中创建类别帖子的下拉菜单

发布于 2024-09-10 18:28:26 字数 529 浏览 3 评论 0原文

我正在为朋友开发这个网站www.annapogossova.com

目前,菜单导航正在通过我创建的每个画廊的页面运行。

当需要扩展网站时 - 我希望它相当动态,以便每个画廊页面/帖子都会自动添加到下拉菜单中,而她没有不必编辑 nav.php 文件即可让它们正确显示。

当然有解决办法吗?我可能以错误的方式进行了设置 - 我应该将画廊创建为帖子而不是页面吗?

如果页面没问题 - 有没有办法更好地工作菜单,以便它列出每个类别下的页面?

我觉得如果所有画廊都是一个类别中的帖子,那么将来效果会更好?

所以目前的 WordPress 结构是:

Nav text is html > ul& li 手动创建导航列表页面 >带有 iframe 的页面(每个新画廊)

这就是 nav.php 当前的样子

- 编辑,我不能发布超过 1 个链接.. 抱歉

I'm working on this site www.annapogossova.com for a friend.

Currently the menu navigation is running through Pages i've created each gallery in.

When it comes time to expand the site - I want it to be fairly dynamic so that each gallery page/post is added to the drop down menu automatically and she doesn't have to edit the nav.php file in order to get them to show correctly.

Surely there is a work around for this? I may have gone about the setup the wrong way - should I have created the galleries as Posts and not Pages?

If Pages are alright - is there a way to work the menu better so that it lists the Pages under each category?

I feel it would work a lot better in the future if all the galleries were Posts in a category??

So the Wordpress Structure is currently:

Nav text is html > ul & li creates nav list pages manually > Page (each new gallery) with an iframe

This is what the nav.php currently looks like

-Edit, I can't post more than 1 link.. sorry

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

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

发布评论

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

评论(1

落日海湾 2024-09-17 18:28:26

页面适合您正在做的事情。为每个顶级导航项创建一个页面。接下来,为每个子级别创建子页面(即在管理控制台中设置其父页面)。您最终会得到如下所示的页面结构:

Photography
    Fashion
        Gallery 1
        Gallery 2
        Etc.
    Still Life
        Gallery 1
        Gallery 2
        Etc.
Art & Illustration
    Gallery 1
    Gallery 2
    Etc.

然后在 nav.php 中,您可以使用以下方法将所有内容输出到

    结构中:

<?php wp_page_menu(); ?>

上述文档方法在这里

Pages are fine for what you're doing. Create a page for each of the top level navigation items. Next, create sub pages for each sub level (i.e. set their page parent in the admin console). You'll end up with a page structure that looks like the following:

Photography
    Fashion
        Gallery 1
        Gallery 2
        Etc.
    Still Life
        Gallery 1
        Gallery 2
        Etc.
Art & Illustration
    Gallery 1
    Gallery 2
    Etc.

Then in your nav.php you can output this all in a <ul> structure with the following method:

<?php wp_page_menu(); ?>

The documentation on the above method is here.

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