Wordpress : Adding custom links to Menu

avi

Well-Known Member
Elite
Nov 23, 2010
4,178
1,737
202
Guys how to add custom links [links to external sites, pages] in Wordpress menu ? Currently I am on 3.2.1 and using default twenty eleven theme.

screenshot :

 

challapradyumna

Well-Known Member
Adept
Aug 11, 2011
1,286
24
58
28
Bangalore
Find this
Code:
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
In header.php and add this
Code:
[url="your site address"]What you want it to show to user[/url]
just after the above code
 

challapradyumna

Well-Known Member
Adept
Aug 11, 2011
1,286
24
58
28
Bangalore
It does not work like the other menu items because the wp_nav_menu automatically creates a list with links and class , id names. It is not possible to add a custom link to the list.
 

avi

Well-Known Member
Elite
Nov 23, 2010
4,178
1,737
202
Thanks man :)

In earlier versions there was a plugin which did the job, this new version is much complicated :-/
 

challapradyumna

Well-Known Member
Adept
Aug 11, 2011
1,286
24
58
28
Bangalore
<div class=menu ><div class="page_item page-item-50"><ul>[*]<a href=techmax.co.in>Techmax</a>[/list]</div></div> Try this code it works replace the things
 

avi

Well-Known Member
Elite
Nov 23, 2010
4,178
1,737
202
where shall I add it ? just like earlier code ?
 

avi

Well-Known Member
Elite
Nov 23, 2010
4,178
1,737
202
Done ! I think it's perfect now :)

thank you man
 

challapradyumna

Well-Known Member
Adept
Aug 11, 2011
1,286
24
58
28
Bangalore
Just Helping :)

--- Updated Post - Automerged ---

Edit the code that i gave you replace the site address and site name to yours!!!!!
 

dreamCatcher

Active Member
Disciple
Jan 23, 2010
144
11
31
Manually adding code to the theme will not help. The next time the theme or wordpress itself is updated, all your changes will disappear. Because with wordpress, Twenty ten and twenty eleven themes will be automatically updated (this is where child themes come into picture). The way to do it is, go to Appearance > Menu > Custom(create your link here) and add it to the menu on the right side. Now on the right side, you can drag and drop them to arrange in the order you like. Click save and you have it.
 

challapradyumna

Well-Known Member
Adept
Aug 11, 2011
1,286
24
58
28
Bangalore
Twenty ten &eleven both support only one menu item. So we have to sacrifice another link to get the custom link. By adding code we can add as many we want.
 

avi

Well-Known Member
Elite
Nov 23, 2010
4,178
1,737
202
@dreamcather - what challapradyumna saying is correct, this new version is complicated & only single menu supported
 

dreamCatcher

Active Member
Disciple
Jan 23, 2010
144
11
31
Just did a wordpress local install and they seem to have limited the menu links to two. You can create the menu in the menu creator but it does not show up. I suggest you use a different theme, or adding code to the theme after every update is the only way.
 

challapradyumna

Well-Known Member
Adept
Aug 11, 2011
1,286
24
58
28
Bangalore
Updating is not needed until 4.0 there we can see some revolutionary changes. But now only some security bugs will be fixed mostly.

--- Updated Post - Automerged ---

@avi I just noticed that your forum has tabs for categories. It took me some time to realise that and most of the other readers too. I suggest you change that to a list style like in TE.