gpt4 book ai didi

php - 无法将 css 类应用于动态菜单

转载 作者:行者123 更新时间:2023-11-28 03:25:22 24 4
gpt4 key购买 nike

整个元素可以在这里找到 Github .

我在标题中的导航栏上添加了一个动态菜单。出于某种原因,我不知道如何将动态菜单与我的 style.css 文件中定义的类或 ID 链接。

出于某种原因,'menu_class' 或 'menu_id' 似乎都不起作用。

这里是 header.php 文件中的菜单:

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<!--Container of my link that are on the far right, they collapse with a small screen-->
<ul class="nav navbar-nav navbar-right">
<!--This code inject the dynamic menu inside thge av bar-->
<!-- The Dynamic menu is managed in the admin section of word press-->
<?php
wp_nav_menu(
array(
/*must have this link to function.php
*In function.php we defined this menu 'alphamenu'*/
'theme_location' => 'top-right-menu',
/*this line of code removes the default menu appearence*/
'container' => false,
/*this line makes the menu with the same layout specified above
*(same as link 1 and 2)*/
'items_wrap' => '%3$s',
/*CSS class applied to the menu*/
'menu_class' => 'nav navbar-nav custom-head-foot',
'menu_id' => 'custom-dynamic-menu'
)
);
?>
</ul> <!--dynamic menu unordered list-->
</div> <!--dynamic menu div-->

function.php 文件:

/*Function to register a custom menu for the admin section
*This resurces was taken from the wordpress codex*/
function custom_theme_setup() {

/*Registered a custom primary navigation menu*/
register_nav_menus (
array( 'alphamenu', __( 'Primary Menu 123') )
);

/*Add theme support for title tag*/
add_theme_support( 'title-tag' );
}
/*Hooking in the function "custom_theme_setup()" after the theme is setup
*surce: wordpress plugin api hooks*/
add_action( 'after_setup_theme', 'custom_theme_setup');

最佳答案

如果 render 方法搞砸了,你总是可以使用 .nav > div 有或没有像 :nth-of-type(1) 这样的伪类,或者有第二种方式:.nav:nth-child(1) 作为查询 div.nav?

中的第一个 child

关于php - 无法将 css 类应用于动态菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44997802/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com