WordPress.org

Ready to get started?Download WordPress

Forums

HTML Navigation Menu to wordpress (6 posts)

  1. markyeoj
    Member
    Posted 2 years ago #

    Hello there, I need some help in this problem.
    I have a static html page and contains a sidebar navigation.
    I tried to to register it in worpress so that the admin can add a menu in the navigation.
    here's the html code for the sidebar navigation
    `if (function_exists('register_nav_menus')) {
    register_nav_menus(
    array(
    'navlist' => 'Main Navigation Menu'
    )
    );
    } `

    and here is the css design

    #navlist
    {
    padding: 0 1px 1px;
    margin-left: 0;
    font: bold 12px Verdana, sans-serif;
    background:#F3F3F3;
    width: 13em;
    border-right:#CCCCCC 1px solid;
    }
    
    #navlist li
    {
    list-style: none;
    margin: 0;
    border-top:#CCCCCC 1px solid;
    text-align: right;
    }
    
    #navlist li a
    {
    display: block;
    padding: 0.25em 0.5em 0.25em 0.75em;
    background: #F3F3F3;
    text-decoration: none;
    }
    
    #navlist li a:link { color: #0E2B8D; }
    #navlist li a:visited { color: #999999; }
    
    #navlist li a:hover
    {
    border-color: #FE3;
    color: #666666;
    background: #FFFFFF;
    }

    before I registered, I deleted first the original code in the sidebar navigation, I deleted the code inside the ul tag : here

    div id="sidebar">
    <img src="fpra_logo.gif" alt="FPRA Tampa Bay"/>
    <br />
    
    <div id="navcontainer">
    <ul id="navlist">
    <li><a href="index.html">Home</a></li>
    <li><a href="about.html">About Us</a></li>
    <li><a href="membership.html">Membership</a></li>
    <li><a href="events.html">Events</a></li>
    <li><a href="job.html">Job Board</a></li>
    <li><a href="apr.html">APR Accreditation</a></li>
    <li><a href="scholarship.html">Scholarship</a></li>
    <li><a href="image.html">Image Awards</a></li>
    <li><a href="resources.html">Resources</a></li>
    <li><a href="news.html">News</a></li><li><a href="contact.html">Contact Us</a></li>
    </ul>
    
    </div>
    </div>

    and replace it with

    <body>

    <div id="wrap">
    
    <div id="sidebar">
    <img src="http://www.fpratampabay.org/fpra_logo.gif" alt="FPRA Tampa Bay"/>
    <br />
    
    <div id="navcontainer">
    	<?php wp_nav_menu(array('menu'=>'Main Nav Menu'));?>
    
    </div>
    </div>

    to see what i mean..
    the original site:http://www.fpratampabay.org/index.htm
    wordpress theme: http://pinoytopics.com/tampa

    the problem is the design is not worked, and I cant open the pages. how it will work? thanks in advance.

  2. muntefer
    Member
    Posted 2 years ago #

    Hi markyeoj!

    There is no element with the id="navlist" (#navlist in css) on the page.
    Thus no styling of yours is rendered on the menu.

    The menu contains elements with id's:
    navcontainer - a <div> holding the nav menu
    menu-main-nav-menu - the

      defining the menu list

      Dump the source or use a webbrowser with css-tool (e.g. Firefox with Firebug) to identify the appropriate element-id to use.

  3. muntefer
    Member
    Posted 2 years ago #

    Hi markyeoj!

    Again and hopefully readable..

    There is no element with the id="navlist" (#navlist in css) on the page.
    Thus no styling of yours is rendered on the menu.

    The menu contains elements with id's:
    navcontainer - a div holding the nav menu
    menu-main-nav-menu - the ul defining the menu list

    Dump the source to an editor or use a webbrowser with css-tool (e.g. Firefox with Firebug) to identify the appropriate element-id to use.

  4. markyeoj
    Member
    Posted 2 years ago #

    Sorry for the late reply, Thank you,, it works, I just thought that it will still work if I us the ul id.. and what u suggested was very helpful, Thank you so much.

    I have another question, The navigation menus are different in other pages, the other has lesser menus while the other has more menus than than main page.. I registered my navigation on wordpress so that the admin can add a menu on the navigation, but what I did mekes my job complicated, If I add a menu on the homepage navigation the other pages also add.. so How can I possibly do that? Is there any way? Thank you sir.

  5. muntefer
    Member
    Posted 2 years ago #

    I have not tried this in WP since I am convinced that a navigation menu should be the same over the whole web site.

    Here follows som ideas to start with:

    As far as I understand you could use the wp_nav_menu argunent $menu ( see Codex) to define which menu to show. You can then ad and modify the menues in the administration panel.

    To get this to work you will have to do a little PHP-programming, adding a function (in the functions.php of your theme) to check the current page and set the menu accordingly in the wp_nav_menu call.

    Another approach would be to add page-templates to your theme that are specific for each menu type required. Say you have three versions of the nav menu to use on all your pages, then you will need three templates.

  6. markyeoj
    Member
    Posted 2 years ago #

    Yehey, go it!, thanks for the tip.. It's very helpful.. thank you very much sir..

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags