WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_get_nav_menu_items help required (10 posts)

  1. Danielx64
    Member
    Posted 3 years ago #

    Hello,

    I'm reading the docs here on wp_get_nav_menu_items and I'm unable to get it working correctly. Does anyone have a good example on how I should use it? Do I use it with http://codex.wordpress.org/Function_Reference/wp_nav_menu and http://codex.wordpress.org/Function_Reference/register_nav_menu?

  2. s_ha_dum
    Member
    Posted 3 years ago #

    What are you trying to accomplish, what are you trying to make that happen, and in what way does it not work correctly?

  3. Danielx64
    Member
    Posted 3 years ago #

    What I'm trying to do is is change the way that wp_nav_menu output it's code.

    Right now it is outputting (the url is just a example)

    <li class="page_item page-item-2"><a href="http://www.giveawayoftheday.com/about/" title="About">About</a></li>

    and I would like to be able to have wp_nav_menu output something like this:

    <li class="menu_button" style="float: left;"><a href="http://www.giveawayoftheday.com/about/" title="Home" style="font-weight: bold; text-transform: none;">Home</a></li>

    What is currently working:

    wp_nav_menu (); - to create the menu
    register_nav_menu(); - to allow wp-admin to control what go on that menu

    What is not working

    wp_get_nav_menu_items(); I'm trying to use that to control the output of wp_nav_menu ();

    Thanks

  4. s_ha_dum
    Member
    Posted 3 years ago #

    You want to add a flaot to the li and change the font on the anchor? All of that you can do with CSS. You shouldn't have to alter the markup at all. Do you have an URL?

  5. Danielx64
    Member
    Posted 3 years ago #

    There is more to that, I'm working on the next version of my ProPress theme and one of the things that I would like to do is port an addon that someone have written for phpBB.

    This addon has a setting page that let you control many different parts.

    The idea of my theme is to allow people to have the same look and feel as their phpBB forum without too much overhead.

    Thanks

  6. Danielx64
    Member
    Posted 3 years ago #

    Ok my last post may not be so clear.

    The mod that I'm porting to wordpress has this bit of code that go into the header:

    http://pastebin.com/qGFduF0y

    and the after would look something like this:

    http://pastebin.com/0GBgLpTu

    Please note that <li class="menu_button" style="float:<?php echo $wphpbb_options['mifloat'];?>"><a href="{buttons.URL}" title="{buttons.NAME}" style="font-weight:<?php echo $wphpbb_options['fweight'];?>text-transform:<?php echo $wphpbb_options['ttransform'];?>">{buttons.NAME}</a></li> would need to be outputted by wp_nav_menu ();

    Mods can you please merge this post with my other one?

    Thanks

  7. esmi
    Forum Moderator
    Posted 3 years ago #

    Sorry - the forum software does not allow us to merge posts.

  8. s_ha_dum
    Member
    Posted 3 years ago #

    Ok. I see. There are several hooks you can use in the Walker but right now I'm thinking you will probably need to create a custom Walker to do this. Basically, you extend the appropriate built in Walker class to make your own. Have you ever tried that? It is surprisingly easy.

  9. Danielx64
    Member
    Posted 3 years ago #

    Thats something that I have never done before. Can you please tell me how I go about doing it?

    I know that I would need to do <?php wp_nav_menu( array( 'walker' => 'wphpbb_mav_menu' ) ); ?>

    Thanks

  10. Danielx64
    Member
    Posted 3 years ago #

    Just the heads up, I was able to get this sorted out :)

Topic Closed

This topic has been closed to new replies.

About this Topic