Postingan lainnya
Bagaimana membuat menu navbar responsive dengan bootstrap 4 di wordpress
Selamat pagi mastah ... Mau buat menu navbar dengan bootstrap 4 tapi tidak berhasil sesuai keinginan ...banyak tutorial sudah dicoba ...kendalanya kayaknya tidak terbaca js nya ... dalam tampilan mobile toggler tidak berfungsi ... dropdown juga tidak jalan ... dan hasil offline dan online tidak sama ...
contoh function.php
function schools_load_file(){
wp_enqueue_style('style', get_template_directory_uri().'/style.css');
wp_enqueue_style('bootstrap-style', get_template_directory_uri().'/assets/css/bootstrap/bootstrap.min.css');
wp_enqueue_style('icons-style', get_template_directory_uri().'/assets/css/material-design-icons.css');
wp_enqueue_script('jquery-js', get_template_directory_uri().'/assets/js/jquery-3.3.1.slim.min.js', array(), '', true);
wp_enqueue_script('popper-js', get_template_directory_uri().'/assets/js/popper.min.js', array(), '', true);
wp_enqueue_script('carousel',get_template_directory_uri().'/assets/js/carousel.js', array(), '', true);
wp_enqueue_script('bootstrap-js', get_template_directory_uri().'/assets/js/bootstrap/bootstrap.min.js', array(), '', true);
wp_enqueue_script('holder-js', get_template_directory_uri().'/assets/js/holder.min.js', array(), '', true);
}
add_action('wp_enqueue_scripts','schools_load_file');
tampilan header.php
<!DOCTYPE html>
<html>
<head>
<title><?php bloginfo('name'); ?></title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="Author" content="">
<meta name="description" content="">
<?php wp_head(); ?>
</head>
<body>
<nav class="navbar navbar-expand-lg" style="background-color: #28a745;">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<a class="navbar-brand" href="#">Hidden brand</a>
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item">
<?php
wp_nav_menu(array(
'menu' => 'main_menu',
'theme_location' => 'main_menu',
'depth' => 2,
'container' => 'div',
'container_class' => 'nav-link',
'container_id' => '',
'menu_class' => 'nav navbar-menu',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker()
));
?>
</li>
</ul>
<?php get_search_form(); ?>
</div>
</nav>
0
1 Jawaban:
Jawaban Terpilih
coba cek <a href=' https://stackoverflow.com/questions/46026899/bootstrap-4-dropdown-menu-not-working '>lapak stackoverflow ini</a>
0