WordPress.org

Support

Support » How-To and Troubleshooting » Add a new menu item in header

Add a new menu item in header

  • durph09

    @durph09

    I’ve created a few new pages and would like to add links to my header menu to those pages. I am using a theme that did not use menus from the wordpress dash board. I’ll include the code and my site is seomagiconline.org.

    Header code

    <div id="menu">
    				<a>" title="Home" id="menu_home"></a>
    				<a>" title="About Us" id="menu_about"></a>
    				<a>" title="F.A.Q" id="menu_faq"></a>
    				<a>" title="Privacy " id="menu_privacy"></a>
    
    <a>" title="Content/Design" id="menu_privacy"></a>
    
    </div>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code has been permanently damaged/corrupted by the forum’s parser.]

    This is the css:

    #menu {
    	float: left;
    	width: 800px;
    	margin: 20px 0px 0px 60px;
    }
    
    #menu_home,#menu_about,#menu_faq,#menu_privacy {
    	float: left;
    	height: 38px;
    	width: 106px;
    	#margin-right: 2px;
    	background: url('images/menu_home.png') no-repeat;
    }
    
    #menu_about {
    	#width: 90px;
    	background: url('images/menu_about.png') no-repeat;
    }
    
    #menu_faq {
    	#width: 71px;
    	background: url('images/menu_faq.png') no-repeat;
    }
    
    #menu_privacy {
    	#width: 153px;
    	background: url('images/menu_privacy.png') no-repeat;
    }
    
    #menu_home:hover,#menu_about:hover,#menu_faq:hover,#menu_privacy:hover {
    	background-position: 0px -40px;
    }

    Again I would like to add more menu items, three actually. I know I can do this by copying and pasting ‘” title=”Home” id=”menu_home”>‘ but them I just get a repeat link to the home page.

    would really appreciate any help.
    Thanks

Viewing 15 replies - 1 through 15 (of 22 total)
  • deepbevel

    @deepbevel

    maybe try:

    <a>" title="New Page" id="new_page"></a>

    with new_page being the page id of your page, and “New Page” being the title. But obviously, call it what you like, just make sure the values match what you have.

    durph09

    @durph09

    I apologize I’m new but what where would I find the page ID. Also I see that my code got cut off. THis is the code in the header for each link:

    ” title=”Home” id=”menu_home”>

    Do I have to alter the CSS to create a new menu_ID

    Thanks for all the help

    durph09

    @durph09

    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="Home" id="menu_home"></a>

    deepbevel

    @deepbevel

    I think the id= is the page slug.
    the permalink uses the slug, so it will be the same as what you will use, it’s normally just the page title with underscores.

    if your page is called “My Page” the slug would be my_page, like this:

    <a>" title="My Page" id="my_page"></a>

    durph09

    @durph09

    I can’t get it to work for me. My permalinks has – between it. I’ve tried both ways. Do I need to do something to the CSS?

    deepbevel

    @deepbevel

    hmm, do you have access to the page slug in the post editor? it’s available through a widget via screen options tab at the top right.

    It’s odd though, the way it says “id=” but then has no page id number, so I was thinking the slug could work. Otherwise maybe try the actual page id number. You’ll see it in the url for the page editor.

    If none of this works, I’m stumped because I don’t understand enough about what makes your menu work, much less why it doesn’t 🙁

    durph09

    @durph09

    No luck. THank you for all of your help. I am almost thinking that title and id refer to the css coding. When I change title of any of the existing menu buttons the button does not change at all

    durph09

    @durph09

    Well I figured out how to change the destination.
    <a href="<?php echo esc_url( home_url( '/about-us' ) ); ?>" title="About Us" id="menu_about"></a>

    By changing ( '/about-us' ) to the page slug it changes destination. Now I have to figure our how to change the writing inside the button. I’ve changed the title=”” and nothing happens. What exactly is the title, does anyone one know?

    The worst part about all of this is that I have done it before and I can’t remember how

    deepbevel

    @deepbevel

    post a link
    it could be that your menu text is an image.

    durph09

    @durph09

    http://seomagiconline.org

    In the menu you will see two extra ‘Privacy Policy’ links and one extra FAQ link. I’ve gotten these by copying the code for them but I’m trying to change the wording inside of them. The last FAQ is directed to a different destination. Which I was able to just do but I am unable to change that it says FAQ

    deepbevel

    @deepbevel

    yep, I saw the .png image in Firebug, Your text is part of an image. You’ll have to make a new one for any new pages you make.
    #menu_faq {
    background: url(“images/menu_faq.png”) no-repeat scroll 0 0 transparent;
    }
    `

    deepbevel

    @deepbevel

    does your theme have a built in way to do that? I’ve never heard of a menu like this before.. is this a custom or premium theme?

    durph09

    @durph09

    I was afraid of that thanks for all of your help. Any ideas how I can do this. I do have access tot he picture but I need a program to edit it.

    durph09

    @durph09

    its custom. I bought it.

    deepbevel

    @deepbevel

    it’s not hard, just a pain compared to the normal way. All you do is add the new image to the folder called “images” in your theme folder, and title it so your code will find it. You’ll have to ftp or use control panel on your server.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Add a new menu item in header’ is closed to new replies.
Skip to toolbar