以本地方式运行项目时,我会收到警告。
卡罗琳娜水疗沙龙警告:
这是我的代码的一部分:
我的header.php:
<div class="navegacion mt-3 py-1">
<nav class="nav-principal navbar navbar-expand-md navbar-light bg-faded ">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
data-target="#nav_principal" aria-expanded="false" aria-label="Toggle Nav">
<span class="navbar-toggler-icon"></span>
</button>
<a href="#" class="navbar-brand d-lg-none">Carolina Spa</a>
<div class="container">
<?php
$args = array(
'menu_class' => 'nav nav-justified flex-column flex-sm-row',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'nav_principal',
'theme_location' => 'menu_principal'
);
wp_nav_menu($args);
?>
</div>
</nav>
</div><!--.navegacion-->
我的functions.php:
<?php
// Cargar hojas de estilos
function carolinaspa_styles() {
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.7.0' );
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '4.0.0');
wp_enqueue_style('google-font', 'https://fonts.googleapis.com/css?family=Italianno|Lato:400,700,900|Raleway:400,700,900', array(), '1.0');
wp_enqueue_style('style', get_stylesheet_uri(), array('bootstrap'), '1.0');
}
add_action('wp_enqueue_scripts', 'carolinaspa_styles');
// Setup Theme
function carolinaspa_setup() {
register_nav_menus( array(
'menu_principal' => esc_html__('Menu Principal', 'carolinaspa'),
'social_menu' => esc_html__('Menu Social', 'carolinaspa')
));
}
add_action('after_setup_theme', 'carolinaspa_setup');
// Agrega la clase nav-item de bootstrap al <li> del menu_principal
function carolinaspa_li_class($classes, $item, $args) {
echo "<pre>";
var_dump($classes);
echo "</pre>";
}
add_filter('nav_menu_css_class', 'carolinaspa_li_class', 1, 3);
我需要通过php的钩子获取我的导航栏,当我想查看类值时,它们无法正确显示。