- This topic is empty.
-
AuthorPosts
-
August 6, 2011 at 6:50 am #33807
Ash149
ParticipantHi everyone,
I have a few questions regarding wordpress, I think they’re kinda simple but whenever I search online I keep finding answers from about 4 years ago so thought I’d get an answer on here…
If this has already been asked then I do apologise! (i did do a search)
Basically, using WordPress for a CMS is all new to me! I’ve been using Joomla but have decided to give WordPress ago, now I’m building a website and I need my home page to have a different CSS file to my other pages – how do I do this?
Next question, when I go to my website I’ve created a custom navigation and added a link called Home and linked it to ‘/’ which takes it back to the home page on my site but doesn’t give it the active item class in the menu so you can’t tell what page your on, all the other pages work fine though (for instance, when you click ‘About’ it becomes the active menu and therefore gets a specific color background).
Any help from either above questions would be hugely appreciated thank you very much!
Ashley
August 6, 2011 at 9:26 am #84549Ash149
ParticipantOk, turns out I just needed to continue watching Chris’s Lynda.com tutorial on WordPress themes for another 5 minutes and I would have got my answer to the custom CSS based on page.
Though any help on how to make a link going to the home page would be appreciated (at the moment in my main menu I just have ‘Home’ which links to ‘/’ and I need it to go to the home page that you get when you go to the site and also for it to add the current item class to the link).
Ash
August 7, 2011 at 11:31 am #84578clokey2k
ParticipantI used a little bit of jQuery to highlight my menu options. I understand it’s not a perfect solution, not very dynamic – but my menu doesn’t change often. It also addresses any child of my menu i.e. a blog post will force the ‘Blog’ menu option to be highlighted.
My code:
$(function(){
var p=location.pathname.substring(1); //Grab the path after the domain;
var s=p.split("///"); //Split at slashes
if(!p){
//If there is nothing after the domain - We are HOME!!
//find the 'nav' link to HOME, and make it 'selected'
$('nav a[href="http://domain.com/"]').attr('class','selected');
} else {
//find the link containing the first part of URL, i.e. BLOG
$('nav a[href*="'+s[0]+'"]').attr('class','selected');
}
});***EDIT***
Ok I have since noticed that it doesn’t work on my site, but the I may have changed my link structure (told you it’s not very dynamic). However the first part of the ‘if’ statement could solve your problem.September 7, 2011 at 2:09 pm #86612ekdr0
MemberHave you tried changing the home page to a selected static page in the admin area of wordpress?
Found in Settings >>Reading.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.