SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast MartyBoi's Avatar
    Join Date
    Dec 2011
    Saginaw MI
    0 Post(s)
    0 Thread(s)

    Question Can't Remove Menu Div Tag, and Replace With Nav Tag

    Hello, here I am again, possibly seeking the same expertise help that many have inquired about before.

    This issue, the removal of the Div Tag that wraps around my Menu has really become top priority. To many this may be trivial, and also petty. But to me, it's not how other feel, it's how I feel. And right now it is my desire and quest to remove that HTML 4.0 Div Tag from wrapping around my Menu and replacing it with the new HTML5 Nav Tag.

    I have been to, and inquired about this same issue within their Forum. And as you can see, I am here still seeking an answer to help me solve this issue. A few in the WordPress Forum told me, that " I should not allow the Div Tag to be an issue ". Whatever!

    So here I am, SitePoint. I'd like to think that most of you / Members / of Sitepoint are way above the curve when it comes to WordPress issues. So I am hoping that someone here in SitePoint is a WordPress Guru.

    Is there anyone whom can help me solve this issue? I want to remove the Div Tag that wraps around my Menu, and then replace it with the new HTML5 Nav tag.

    I had read many so called solutions that are offered, and too, had worked for others. But as fate would have it, none, or either had worked for me. So, I am starting to wonder if I am the problem. Because most of the time, I am. I had used Filters, and many others known fix's. Fail Fail Fail !

    This is what I have now in my function.php:

    PHP Code:
    // Register Navigation Menu
    function register_my_menus() {
    'main-navigation' => __'Main Navigation' )
    add_action'init''register_my_menus' ); 
    This is what I have in my header.php:
    PHP Code:
    <!-- Call/Place Nav Menu inside Header -->
                <?php wp_nav_menu( array( 'theme_location' => 'main-navigation') ); ?>
    And this is that darn Div Tag that is in my Mark-Up:
    <div class="menu">
    <li class="page_item page-item-5">
    <a href="http://localhost/wordpress/?page_id=5">Home</a>
    <li class="page_item page-item-7">
    <a href="http://localhost/wordpress/?page_id=7">Sample1</a>
    I had used:
    PHP Code:
    <?php wp_nav_menu( array('container => ' ', 'theme_location' => 'main-navigation') ); ?>
    and/ or
    <?php wp_nav_menu( array('
    container => false'theme_location' => 'main-navigation') ); ?>
    And so on.....

    Even used this:

    PHP Code:
    function my_wp_nav_menu_args$args '' )
    $args['container'] = false;
    // function

    add_filter'wp_nav_menu_args''my_wp_nav_menu_args' );


    <?php wp_nav_menu( array( 'container' => '' ) ); ?>
    Nothing worked....

    Can anyone help me?

  2. #2
    SitePoint Member
    Join Date
    Nov 2011
    0 Post(s)
    0 Thread(s)
    Well to change this how you wanted demands digging into wordpress core. You can put <?php wp_nav_menu( array( 'theme_location' => 'main-navigation') ); ?> into nav to look like this: <nav><?php wp_nav_menu( array( 'theme_location' => 'main-navigation') ); ?></nav> and that should do it. I would recommend to give <nav> some id and set up like you wanted.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts