php - Bootstrap 下拉菜单不显示 Wordpress 下拉菜单中的项目
问题描述
我正在开发一个子主题,并在我的主题的通用 wp_enqueue_style 之前将 Bootstrap 添加到 functions.php 中,如下所示:
if ( ! function_exists( 'ghostpool_enqueue_child_styles' ) ) {
function ghostpool_enqueue_child_styles() {
wp_enqueue_script( 'bootstrap_js', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js', array('jquery'), NULL, true );
wp_enqueue_style( 'bootstrap_css', 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css', false, NULL, 'all' );
wp_enqueue_style( 'ghostpool-style', get_template_directory_uri() . '/style.css', array(), AARDVARK_THEME_VERSION );
wp_enqueue_style( 'ghostpool-child-style', get_stylesheet_directory_uri() . '/style.css', array( 'ghostpool-style' ), AARDVARK_THEME_VERSION );
wp_style_add_data( 'ghostpool-child-style', 'rtl', 'replace' );
}
}
add_action( 'wp_enqueue_scripts', 'ghostpool_enqueue_child_styles' );
然后我在一行中添加了原始 HTML,每列有 4 列,如下所示:
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
CHOOSE A GENRE
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
我的下拉按钮显示正确,但是当我单击它们时,它们不显示下拉列表中的内容?我是否忘记在functions.php中添加任何特殊的js?我错过了什么吗?
解决方案
推荐阅读
- gitlab-ci - gitlab CI 中的 Gradle 和 Mysql
- android - Embarcadero RAD Delphi 10.3.3,无法使用适用于 64 位 Android 的 Box2D 库编译我的应用程序
- android-studio - 我在颤振中遇到错误,即在 null 上调用了方法“+”
- python - 如何压缩两个序列(一个由 N 个元素移动)?
- flutter - 如何将另一个图标的图标中心放在颤动中
- laravel - Laravel 为 Web 和 API 控制器分离文件夹导致错误
- mysql - JPA Hibernate 多对多 NestedServletException 问题
- http - 当 HTTP 标头和元标记中都存在 Content-Security-Policy 时的问题
- node.js - Node.js 中是否有支持 `addEventListener()` 的工作人员?
- html - 如何编辑 ul li 字体大小和样式?