How to add navigation links on header
-
Hi, i have created 4 menus but in my home page it is only one visible in header. How could i add them all?
Thanks in advance.
-
Could you provide a link to the site?
of course. https://www.styleheroine.com
thank youWhen I looked at the source it appears to be an H5 Tag floating in a Div container. I would recommending placing all your buttons in an unordered list by registering it as a Nav Menu.
How comfortable with editing the PHP and CSS files? If you’re comfortable I can walk you through a little, if not you may need to do some reading, which I can help with too.
i am completely uncomfortable, so i’ll better do the reading!
After I looked more in your Source code I noticed something I just missed earlier. I’m not sure how familiar you are with WordPress so forgive me if I walk you through something that might be elementary to you.
In your Admin section go to Appearance then Menus. Do you see a Menu on the right – if so, does it have all your buttons, or just the “Daily Looks” Page?
hi,
thank you for your kindness, i am familiar with wordpress and i understand a little codex because this blog is heavily modified by myself from its original theme. Of course because i had no idea about codex and wordpress i have done a lot of mistakes( see my comment form to laugh) but some things i can handle( i think). So in my admin-appearance -menus i have all the buttons on the upper middle side with the menus i have added.
in theme locations on left says “Your theme supports 0 menus. Select which menu appears in each location”.
EvangelieIt’s hard to say how to proceed in that I’m not familiar with the theme. When you want to add a new Menu to a theme, the steps you generally need to take are…
1 – Register the Nav Menu in your functions.php file
2 – Call the Menu in another php file, generally the sidebar.php or header.php – in this instant probably the header.php
3 – Create the Menu in the Admin section and place the buttons.Unfortunately, depending on how your theme was built this task could either be very easy or not so easy. I’ll give you the steps just in case it is easy.
—
Step 1 – Registering the Nav Menu.
Open your functions.php file and navigate to the bottom. Make some space right above the last closing tag?>
Enter the following
if (function_exists('register_nav_menus')) { register_nav_menus( array( 'main_nav' => 'Your Menu' ) ); }
You can rename ‘Your Menu’ to anything else you want.
—
Step 2
In your header.php find where you want the menu. I saw the original in a div tag with an id of navbar …<div id="navbar">
If you want to use this one then simply call the registered nav menu within it – if not you can place the call where you would prefer.
To call the nav menu we registered, enter the following…
<?php wp_nav_menu(array('menu' => 'Your Menu' )); ?>
—
Step three is to go into your admin, add the menu by naming the menu Exactly the same thing, in this example Your Menu. Then add some buttons and it will be placed.Depending on where you place it there may need to be some additional styling. Note that it will automatically be wrapped as an Unordered List where each button is a List Item.
Let me know if you need any help with that part.
thank you so much.i’ll try to do my best. Could i ask one last question? I add widgets to the sidebar through appearance-widgets..etc but they are not visible in my home page. It seems like the sidebar is not working for a reason. Do you know where to start to look for the missing part?
First check in your WP Admin under Settings and then Reading – if “Front Page Display” has the bullet selected “Your Latest Posts” then the file we will first look for is your index.php file or home.php file. If your folder has a home.php file it will trump the index.php so that’s where we’ll look, if it doesn’t have one then we’ll use the index.php file.
If the bullet is checked to “A Static Page” then we’ll need to go to the page it lists. When you are on that page on the right hand side will be an option called “Template” – if it has a name then that will likely correspond to the php files name. If it is set to default then you’ll look for your page.php file.
—
Ok, so by now you should have navigated to either the index.php, home.php, page.php, or some-custom-template-file.phpWhen inside that file make certain that the them calls the sidebar. This will look something like
<?php get_sidebar(); ?>
If the file is not called then you can call it now, though keep in mind that you will want to style it to work with your theme.
—
That should solve your problem, though you will need to style your page up to make that sidebar work. I recommend wrapping it in a<div>
tag. Note that many widgets will use unordered lists and will have default settings for header tags (i.e. h2,h3,etc). You can see what these are in your functions.php file. The class for all widgets is “widget” – you can also use your browsers inspecting functions (depending what browsers you’re using) to find the unique classes for each individual widget.thank you for evelything, i’ll let you know my progress:-)
No problem Evangelie – I hope it all helps and that you are able to make some great progress.
Keep me posted and I’ll help more if I can ??
thank you!
- The topic ‘How to add navigation links on header’ is closed to new replies.