【问题标题】:create own wordpress theme (tewnty ten as base)创建自己的 wordpress 主题(十个作为基础)
【发布时间】:2011-03-28 01:59:12
【问题描述】:

我必须创建一个自定义的 wordpress 主题。 我仍然不知道它应该是什么样子,所以查看了 20 个主题文件以找出我可以自定义的内容。 所以我在header.php文件中搜索了菜单构建功能,发现了这个

<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?> <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

但我不知道这个函数是做什么的...哪里写了菜单是如何使用&lt;ul&gt;&lt;li&gt;等html标签创建的... 我不想编辑html代码!

问候, 彼得

【问题讨论】:

    标签: wordpress themes


    【解决方案1】:

    查看法典中的documentation 以获取wp_nav_menu。这是 WordPress 2.9 版添加的菜单系统(我相信)。如果您在仪表板中导航到外观 -> 菜单,则可以通过界面对其进行自定义。在 20 中,后备是 wp_page_menu,它会显示您的页面列表。如果您更喜欢手动构建并将其硬编码到主题中(不建议,但可能),只需删除相关代码并将其替换为您自己的 HTML。

    我的建议是查看菜单界面,创建一个菜单,将其分配给主题位置“主要”,然后从那里使用一个可正确配置且由 WP 驱动的菜单。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-28
      • 2013-07-23
      • 1970-01-01
      • 1970-01-01
      • 2014-06-12
      • 1970-01-01
      • 2013-08-18
      • 2021-07-27
      相关资源
      最近更新 更多