- This topic is empty.
-
AuthorPosts
-
May 3, 2014 at 5:42 am #169141
r3quiem
ParticipantI have been recieving help on another part of the forum from @chrisburton and @wolfcry911 as to possible solutions and would appreciate any help.
I am using the WP Twenty Fourteen theme and looking to split my top navigation menu in 2 around a central logo (img which will be used as a link)
Current Navigation: http://s22.postimg.org/a62l7kckh/Top_Nav.jpg
Desired Navigation: http://s27.postimg.org/o2wlaiwyr/Top_Nav_wanted.jpgI am new to PHP.
If this could be done solely with html/css that would be great, however I cant find the HTML running behind the wordpress theme.Thanks in advance
May 3, 2014 at 10:56 am #169153chrisburton
ParticipantLet me know when you get the FTP issue sorted out.
May 21, 2014 at 10:40 am #170813r3quiem
ParticipantHi @chrisburton
I have done exactly what you said
@r3quiem I contacted Chris Coyier to get the above post fixed so you could copy the PHP to put into your theme. I no longer use WordPress because it’s pretty much overkill for most websites so I had to download it for the following answer.
First, let’s get organized.
Create a file inside your theme and name it menu.php. Now, go into header.php and scroll down until you get to the navigation. Copy the navigation to menu.php and save. In header.php, replace that navigation code you’ve just copied with the following:
include ‘menu.php’;
menu.php should look like this header.php should look like this.
From this point I will have to wait until the post above is fixed so I can copy the code and help you further. At least your structure is a bit more organized.>
But now I seem to have lost my nav completely. Am i supposed to name the 2 anything specific?
May 21, 2014 at 10:43 am #170814chrisburton
ParticipantBut now I seem to have lost my nav completely. Am i supposed to name the 2 anything specific?
What do you mean you’ve lost it? Post your header.php and menu.php
May 21, 2014 at 10:58 am #170817r3quiem
ParticipantEDITED: DELETED
May 21, 2014 at 11:03 am #170818r3quiem
Participantheader.php (in parent theme)
http://pastebin.com/raw.php?i=QnJLh5Hj
menu.php (in child theme)
The navigation has disappeared from the top of my page when I implement those changes.
May 21, 2014 at 12:09 pm #170821chrisburton
ParticipantThat’s because of a few reasons:
- You didn’t use php tags in your include. It should be
<?php include 'menu.php'; ?>
- Also, if
'menu.php'
is not in the same location asheader.php
, you need to change it to'path/to/menu.php'
.
If that doesn’t make sense, let me know.
May 23, 2014 at 1:40 pm #170966r3quiem
ParticipantHi @chrisburton
OK I now have the menu.php in the same folder as my header.php, the code has been changed to the php function you gave me. The menu is still there.
How do I now get the logo in the middle?
It is still currently 1 menu also.
Thanks
The site is currently live while I recieve some help
Let me know if you need it unlocked to take a look.
May 23, 2014 at 5:58 pm #170973chrisburton
Participant@r3quiem I’ll help you in a little while if that’s OK. I just got in from traveling.
May 23, 2014 at 8:09 pm #170975chrisburton
Participant@r3quiem In your WordPress admin section, go to Appearance > Menus. You need to create two separate menus. One for the left side and one for the right.
Then, in your
menu.php
file you need to edit your code to the following: link hereNotice the
'menu' => 'Main'
and'menu' => 'Secondary'
. Change those to whatever you named your two menus.May 24, 2014 at 5:58 am #170989r3quiem
ParticipantThanks for this
OK I have called
first menu is called ‘Main Menu’
second menu is called ‘Second Menu’I have edited menu.php to include the code you just posted in the link, between the nav tags.
I now have ‘menu’= ‘Main’ and ‘menu’ => ‘Second’I have unticked the “Top Primary Menu” to place it in top menu on both, let me know if this is right? Menu Settings
Click here, I have taken maintenance mode again, and you can see what has happened. First menu has appeared, Second is not there, and there is a massive gap before the content.
Cheers
May 24, 2014 at 6:12 am #170990r3quiem
ParticipantSorry I have been messing with a bit more since.
Ive realised that ul id=”secondary” was taking all its styling from a navigation which is set for the left hand side, so I have now changed this to be primary-navigation so that it becomes part of the primary nav. So it has now appeared.
Looks like we are getting there!
Essentially what I need to do now, is get the 2 menu’s on the same line, and plonk that logo in the middle of them with a link to the main page.
Im guessing I could hack that logo in around the h1 mark with an a href and img? So its just getting them up on the same line really which is the issue. Not sure if its previous styling Ive done or php which is preventing that at the moment?
Thanks!
I am so happy this is coming together, this has been a headache for me for weeks!
May 24, 2014 at 7:54 am #170996chrisburton
Participant@r3quiem What you can do for your logo is:
.logo { background: url('path/to/image.png'); }
I have the CSS in that previous thread where I mentioned the PHP code if you want to find it. That will line up the menus but you may have to mess with the logo margins.
Remember that in the PHP code where it showed
<ul id="main">
and<ul id="secondary">
, they need to have different ID’s or classes so that you can separate them.May 24, 2014 at 8:26 am #170997r3quiem
ParticipantLogo:
Ive tried this and it wont add as a background image to the h1. I added the exact css you put there, with the link to the image. Now I have removed the class system for the h1, and added the logo as an img so all elements are there, just need them inline now. Been messing with firebug but cant quite get the logic to the problem.Inline:
If i changed the id on the second menu would it not lose all the styling brought though from the parent/child themes? I can’t quite figure out why its not going into 1 line, comparing with the php you posted on the first page of the previous thread.Thanks
May 27, 2014 at 11:36 am #171179chrisburton
Participant@r3quiem The reason you are having trouble is because:
- You changed the code within the PHP from
<ul id="secondary">
to<ul id="main">
. So now both menus have an ID ofmain
. They need to be different from each other so that you are able to position one to the left side of the logo and the other to the right. Make sense? - You have not used CSS to position the menu and logo inline with each other.
If you need help, please paste the code I gave you previously into
menu.php
. Of course the page is going to look weird because you have not created the CSS to position them where they should go. - You didn’t use php tags in your include. It should be
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.