使用jquery按字母顺序显示导航菜单列表

发布于 2024-09-13 11:05:48 字数 739 浏览 1 评论 0原文

我希望一些聪明的人可以在这里帮助我。我已经超出了我的深度。不久前我为我开发了一个 WordPress 网站。我向开发人员支付了他的工作费用,但他从未兑现他的承诺,所以我只能尝试修复它。无论如何...

该网站使用一些 jquery 来激活下拉菜单。当您单击名为“项目”的链接时,它会显示一个包含帖子列表的滑出菜单。该菜单包含 6 列文本,并按时间顺序显示帖子。

我需要实现两件事: 1. 我需要这个菜单按字母顺序而不是按时间顺序列出帖子。 2. 我需要列表顺序从上到下,从第一列开始,并在其他 5 列中继续从上到下。目前它是水平排列的,所以即使是按字母顺序排列,也会是错误的顺序。

当前驱动菜单的代码如下(我认为)。有谁知道我如何更改它以便在加载时应用字母排序?我真的不知道从哪里开始,非常感谢任何帮助。

function RegisterMenus() {        
    register_nav_menu('primary-menu', __( 'Primary Menu' ));
}

Wordpress 网站上的此页面似乎包含有关如何进一步自定义代码的更多信息:

http: //codex.wordpress.org/Function_Reference/wp_nav_menu

I am hoping some smart folks can help me here. I'm out of my depth. I had a wordpress site developed for me a little while ago. I paid the developer for his work, but he never delivered what he promised so I am left to try and fix it. Anyway...

The site uses some jquery to activate a drop down menu. When you click on a link called "Projects" it displays a slide out menu containing a list of posts. This menu contains 6 columns of text, and displays the posts in chronological order.

There are two things I need to achieve:
1. I need this menu to list the posts alphabetically and not chronologically.
2. I need the list order to go from top to bottom, starting from the 1st column, and continuing top to bottom in the other 5 columns. Currently it goes horizontally, so even if it was alphabetical, it would be the wrong order.

The code the currently drives the menu is below (I think). Does anyone know how I can change this so it applies the alphabetical sorting when it loads? I really don't know where to start and would be so grateful for any assistance.

function RegisterMenus() {        
    register_nav_menu('primary-menu', __( 'Primary Menu' ));
}

This page on the Wordpress site appears to have some more info about how to ad further customisation to the code:

http://codex.wordpress.org/Function_Reference/wp_nav_menu

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

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

发布评论

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

评论(2

滴情不沾 2024-09-20 11:05:48

此 JavaScript 不会对菜单进行排序。菜单的顺序可能是在 WordPress 的管理页面上定义的,您也应该在其中尝试编辑它(不需要编码)。我不确定列表顺序方向,可能与 JavaScript 或 CSS 有关 - 但它也可能是 WordPress 中的一个设置或一段代码。不管怎样,你给我们的代码片段是无辜的。

This JavaScript isn't sorting the menu. The menu's order is probably defined on an administration page in WordPress, which is also where you should try editing it (no coding should be required). I'm not sure about the list order direction, that might have to do with either JavaScript or CSS - but it could also be a setting or a piece of code in WordPress. Anyway, the code snippet you gave us is innocent.

潜移默化 2024-09-20 11:05:48

如果您使用的是 WP3,您可能是默认的 WP 主题“二十十”或基于该主题,因此请在“外观/菜单”中查看以更改菜单排序和级别。无需编辑代码。

If you're using WP3, your might be either the default WP theme Twenty Ten or is based on that theme, so look in Appearance/Menus to change the menu sort and levels. No code editing required.

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