better-amp icon indicating copy to clipboard operation
better-amp copied to clipboard

Sidebar not working with my code

Open benfiratkaya opened this issue 6 years ago • 1 comments

Hello i use this code in functions.php

  function benfiratkaya_add_search_form($items, $args) {
    if ($args->theme_location == 'primary') {
      $searchForm = get_search_form(false);
      $items      .= $searchForm;
      return $items;
    }
  }
  add_filter('wp_nav_menu_items', 'benfiratkaya_add_search_form', 10, 2);

if use this code not showing sidebar menu items.

benfiratkaya avatar Aug 20 '19 21:08 benfiratkaya

I fixed with this code:

  function benfiratkaya_add_search_form($items, $args) {
    if ($args->theme_location == 'primary' && !is_better_amp()) {
      $searchForm = get_search_form(false);
      $items      .= $searchForm;
    }
    return $items;
  }
  add_filter('wp_nav_menu_items', 'benfiratkaya_add_search_form', 10, 2);

i checking with 'is_better_amp()' function

benfiratkaya avatar Aug 20 '19 21:08 benfiratkaya