• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Remove ul and li Elements From Navigation Menus

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove ul and li Elements From Navigation Menus

This topic is: not resolved

Tagged: genesis_nav_menu, genesis_pre_nav, navigation

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 10 months ago by Susan.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • July 9, 2015 at 12:58 pm #158610
    Brad West
    Member

    I'd like to remove the ul and li elements WordPress adds to menus. I'm using my personal site to test this, but having trouble. As it is now, the area around the menu elements turns blue when you hover, but you can only click on the text.

    After reading an article on CSS-Tricks I was able to get this to work for a client site. You'll notice that you can click anywhere in the blue box, not only the text. The HTML for that nav menu looks like this:

    <nav class="nav-primary genesis-nav-menu responsive-menu" role="navigation" itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement"><a class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2139" href="http://flagtheory.com/about/">About Flag Theory</a>
      <a class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2137" href="http://flagtheory.com/offshore-company/">Offshore Company</a>
      <a class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2138" href="http://flagtheory.com/offshore-banks/">Offshore Banking</a>
      <a class="menu-item menu-item-type-post_type menu-item-object-page menu-item-2400" href="http://flagtheory.com/society/">PT Society</a>
    </nav>

    Below is the code I used. And since that site only has one menu it worked fine.

    add_filter( 'genesis_do_nav', 'bw_sidebar_strip_li' );
    function bw_sidebar_strip_li() {
      $cleanermenu = wp_nav_menu( array(
        'container' => false,
        'items_wrap' => '<nav class="nav-primary genesis-nav-menu" role="navigation" itemscope="itemscope" itemtype="http://schema.org/SiteNavigationElement">%3$s</nav>',
        'echo' => false,
      ) );
    
      $find = array('><a','<li');
      $replace = array('','<a');
    
      echo str_replace( $find, $replace, $cleanermenu );
    
    }

    On a site that's using a primary and a secondary menu, this function breaks. It only produces one menu, yet outputs it in two places even when I create two filters to target both genesis_do_nav and genesis_do_subnav.

    Any ideas?

    I think the genesis_pre_nav filter might be useful for this, but can't get it working. I've also tried a walker but haven't had success with that either.

    http://bradonomics.com/
    December 8, 2015 at 6:11 am #173182
    Susan
    Moderator

    As you posted this a while ago, I'm hoping that you were able to get your issue resolved 🙂 - if not, report back here, so it can be escalated.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble