Hello I woul like to add a button in my homepage menu. Next the add to cart button. Is there any simple way to do that ?
Thank for your help.
Hello I woul like to add a button in my homepage menu. Next the add to cart button. Is there any simple way to do that ?
Thank for your help.
Hi @calinda,
To add a button to your menu, you can add the code below in your child theme’s functions.php
function add_search_form($items, $args) {
if( $args->theme_location == 'primary' ){
$items .= '<li class="menu-item my-button">'
. '<a class="x-btn x-btn-flat x-btn-rounded x-btn-mini" href="#example" >Round Button</a>'
. '</li>';
}
return $items;
}
add_filter('wp_nav_menu_items', 'add_search_form', 10, 2);
Change #example with your link and change Round Button with your text.
You might need to align your button with your other menus,so you can add this in Theme Options > CSS
.x-navbar .desktop .x-nav > li.my-button a {
height: auto;
outline: none;
padding: 10px;
margin-top: 28px;
Change padding and margin to adjust alignment.
Hope this helps
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.