Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter vimpan

    (@vimpan)

    I have pasted it in the functions.php but nothing changes in the menu on the site, any other idea?

    Great thanks for taking the time and helping!

    Thread Starter vimpan

    (@vimpan)

    in the nav.php i have this;

    <?php
    /**

    • Cleaner walker for wp_nav_menu()
      *
    • Walker_Nav_Menu (WordPress default) example output:
    • Home
    • Sample Page</l
      *
    • Roots_Nav_Walker example output:
    • Home
    • Sample Page
    • Remove the id=”” on nav menu items
    • Return ‘menu-slug’ for nav menu classes
      */
      function roots_nav_menu_css_class($classes, $item) {
      $slug = sanitize_title($item->title);
      $classes = preg_replace(‘/(current(-menu-|[-]page[-])(item|parent|ancestor))/’, ‘active’, $classes);
      $classes = preg_replace(‘/^((menu|page)[-_\w+]+)+/’, ”, $classes); $classes[] = ‘menu-‘ . $slug; $classes = array_unique($classes); return array_filter($classes, ‘is_element_empty’);
      }
      add_filter(‘nav_menu_css_class’, ‘roots_nav_menu_css_class’, 10, 2);
      add_filter(‘nav_menu_item_id’, ‘__return_null’);
    • Clean up wp_nav_menu_args
      *
    • Remove the container
    • Use Roots_Nav_Walker() by default
      */
      function roots_nav_menu_args($args = ”) {
      $roots_nav_menu_args = array(); $roots_nav_menu_args[‘container’] = false; if (!$args[‘items_wrap’]) {
      $roots_nav_menu_args[‘items_wrap’] = ‘
        ‘;
        } if (!$args[‘depth’]) {
        $roots_nav_menu_args[‘depth’] = 2;
        } return array_merge($args, $roots_nav_menu_args);
        }
        add_filter(‘wp_nav_menu_args’, ‘roots_nav_menu_args’);
      Thread Starter vimpan

      (@vimpan)

      In that file I have this;

      <?php
      /**

      • Roots includes
        *
      • The $roots_includes array determines the code library included in your theme.
      • Add or remove files to the array as needed. Supports child theme overrides.
        *
      • Please note that missing files will produce a fatal error.
        *
      • @link https://github.com/roots/roots/pull/1042
        */
        $roots_includes = array(
        ‘lib/utils.php’, // Utility functions
        ‘lib/init.php’, // Initial theme setup and constants
        ‘lib/wrapper.php’, // Theme wrapper class
        ‘lib/sidebar.php’, // Sidebar class
        ‘lib/config.php’, // Configuration
        ‘lib/activation.php’, // Theme activation
        ‘lib/titles.php’, // Page titles
        ‘lib/nav.php’, // Custom nav modifications
        ‘lib/gallery.php’, // Custom [gallery] modifications
        ‘lib/scripts.php’, // Scripts and stylesheets
        ‘lib/extras.php’, // Custom functions
        );

      foreach ($roots_includes as $file) {
      if (!$filepath = locate_template($file)) {
      trigger_error(sprintf(__(‘Error locating %s for inclusion’, ‘roots’), $file), E_USER_ERROR);
      }

      require_once $filepath;
      }
      unset($file, $filepath);

      Thread Starter vimpan

      (@vimpan)

      @ashish121 I am sorry but I cant understand where I find this

      • This reply was modified 9 months ago by vimpan.
    Viewing 4 replies - 1 through 4 (of 4 total)