Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // adiciona produto ao menu se categoria existir
- add_filter( 'wp_nav_menu_items', 'adiciona_produto_menu', 10, 2 );
- function adiciona_produto_menu( $items, $args ) {
- // não funciona com a categoria samsung
- //if( has_term( 'samsung', 'product_cat' ) ) {
- if( has_term( 's9-plus', 'product_cat' ) ) {
- $produto = '<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children">
- <div class="nav-toggle-subarrow">
- <i class="fa fa-angle-down"></i>
- </div>
- <a href="#">
- <i class="fa fa-shopping-cart"></i>
- <span class="fontawesome-text">Produtos</span>
- </a>
- <ul class="sub-menu">
- <li class="menu-item menu-item-type-custom menu-item-object-custom">
- <a href="#">
- <span class="fontawesome-text">Samsung</span>
- </a>
- </li>
- </ul>
- </li>';
- }
- return $produto.$items;
- }
- $args->theme_location == 'primary'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement