Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6614105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:17:55+00:00 2026-05-25T20:17:55+00:00

I am trying to modify sub-menus of a WordPress site. WordPress generates the following

  • 0

I am trying to modify sub-menus of a WordPress site. WordPress generates the following HTML code for the sub-menus

<ul class="sub-menu" style="top: 50px; visibility: visible; left: 0px; width: 202px; display: none;">
    <li class="menuitem123 menu-item menu-item-type-post_type menu-item-object-page menu-item-123" id="menu-item-123"><a href="http://www.example.com" class="">Link Name</a></li>
        <!-- other li elements follow -->
</ul> 

Here’s my invocation of the wp_nav_menu

<?php if(has_nav_menu('secondary')):?>
    <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'menu_container' => 'div', 'container_id' => 'secondary-menu','menu_class' => '',  'theme_location' => 'secondary'));?>
<?php endif;?>

The problem is, I want to customize the inline style (or preferably move it out into a css file) that WordPress is generating for the ul element, mainly the width. I have searched high and low but cannot find from where WordPress is picking up the inline style and inserting it. I need to get rid of the inline style because I need to set different width for other sub-menus.

I could adapt the answer given on this wp_nav_menu change sub-menu class name? link which suggests sub classing the WordPress Walker class.

Please can someone provide some pointers on what else should I be checking to see from where WordPress is picking up the inline style?

Many thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:17:55+00:00Added an answer on May 25, 2026 at 8:17 pm

    WordPress itself does not generate any inline styles, so most probably the deal is in your plugins or theme installed. According to your code, you do not use customized walkers, so the only deal may be in filters attached to standard Walker_Nav_Menu (see nav-menu-template.php file, at the beginning). Corresponding filters are most probably: nav_menu_css_class, nav_menu_item_id, walker_nav_menu_start_el.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to modify the class of an element if an ajax call based
I've been trying to modify the AuditTrail code so that it does not copy
I am trying to modify an existing PDF with iText. My code currently edits
I'm trying to modify the HTML markup of a page in order to add
I'm trying to modify the following query to find the rank of a specific
Im trying to modify the class below so that the scrolling text appears behind
I’m trying to modify a string of the following form where each field is
I'm trying to modify a code not written by me, so I want to
I am trying to modify some open source code to change how it filters
I am trying to modify a theme on wordpress. The theme shows a slider

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.