Hey all!
I'm building a site for a friend which uses this Wordpress theme: http://www.felixkrusch.de/about
^ As you can see by visting the site, the title of the current page is always underlined on the main menu.
In the code the menu is displayed by this code: - <li <?php if(is_home()){echo 'class="current_page_item"';}?>><a href="<?php bloginfo('siteurl'); ?>" title="Home">Home</a></li>
-
-
<?php wp_list_pages('title_li=&depth=1');?>
and a snippet of css in the stylesheet: - .current_page_item a {
-
-
color:#000;
-
-
text-decoration: underline;
-
-
}
I want to add links to category pages in the menu, but if I add an example like this to the menu: - <a href="blahblah.com/cat/videos">Videos</a>
There is no underline for that page.
Does anyone know a way that I can achieve the same underline effect for non-Pages I add to the menu?
There must be some way to adapt this code for other URLs? - <li <?php if(is_home()){echo 'class="current_page_item"';}?>><a href="<?php bloginfo('siteurl'); ?>" title="Home">Home</a></li>
If anyone can help I'd be hugely grateful, thank you in advance! 11 5658 Dormilich 8,658
Recognized Expert Moderator Expert
put your link in an element (li, div, span, ...) that contains the current_page_it em class. - <span class="current_page_item">
-
<a href="_your_uri_">_link_text_</a>
-
</span>
regards
I might be wrong but I don't think that would work.
I want the underline to appear only on the page currently being browsed by the visitor. If I added the above bit of code, would it not always apply the underline?
Thanks,
There must be some way to adapt this code for other URLs? - <li <?php if(is_home()){echo 'class="current_page_item"';}?>><a href="<?php bloginfo('siteurl'); ?>" title="Home">Home</a></li>
Try the PHP forum PHP forum
Thanks for the help all,
I will move this conversation to the PHP forum, cheers.
eWish 971
Recognized Expert Contributor
Moving to PHP Forum.
--Kevin
Dormilich 8,658
Recognized Expert Moderator Expert
There must be some way to adapt this code for other URLs? - <li <?php if(is_home()){echo 'class="current_page_item"';}?>>
-
<a href="<?php bloginfo('siteurl'); ?>" title="Home">Home</a>
-
</li>
do you know, how the is_home() function works? then you could it adapt for categories too.
do you know, how the is_home() function works? then you could it adapt for categories too.
Dormilich: I have no idea how the is_home() function works.
Do you have any idea?
Repeating it for categories would be perfect.
Thanks
Dormilich 8,658
Recognized Expert Moderator Expert
option 1 - you have access to the server and the function is defined somewhere in a script file on the server - just scan the script files for this function
option 2 - is_home() belongs to a wordpress hosted script - no luck
option 3 - there is a wordpress documentation
option 4 - write your own is_category() function
for option 4 I'd like to see more of the script, because this function also depends on how the category menu is build. as a general idea the function would probably compare the siteurl with the category link (e.g. preg_match()).
regards
I think option 3: http://codex.wordpress.org/Condition..._Category_Page
I am wholly uneducated in PHP so I hope you can confirm or deny my theory, that I should be able to get the result I want using the structure below. -
<li <?php if(is_home()){echo 'class="current_page_item"';}?>>
-
<a href="http://homepage.com" title="Home">Home</a>
-
</li>
-
-
<li <?php if(is_category('9')){echo 'class="current_page_item"';}?>>
-
<a href="http://homepage.com/cat/apple" title="Posts Filed in Apple">Apple</a>
-
-
<li <?php if(is_category('10')){echo 'class="current_page_item"';}?>>
-
<a href="http://homepage.com/cat/windows" title="Posts Filed in Windows">Windows</a>
-
For the record: categories are each given a numeric value besides its name, Apple might be 9, Windows might be 10, and so on, like I've shown here.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Tim Daneliuk |
last post by:
I am currently underling the first character of a menu title (to indicate
its shortcut/accelerator key) like this:
self.WildBtn = Menubutton(self.mBar, text=WILDMENU, underline=0, state=DISABLED)
However, I intend to actually have two separate keys invoke this menu
to have it behave differently in different circumstances.
Is it possible to underline more than a single character as I am doing
with the 'underline=0' above. I tried...
|
by: bayouprophet |
last post by:
Cant get menu script to to put linked page in the same frame. I am
new to Java
and I am wondering what am I doing wrong? below are my java applet
file, frame.html file, and my text file and one of my link file that
should load next to the menu on the same page. And Thank You in
advance.
Here is my menu applet:
<html>
|
by: Dan |
last post by:
When a user clicks on a link in my menu, I want the background color
of the link that comes up in the hover to remain on the destination
page.
My menu looks like this:
<div id="adminmenu">
<a class="mainlink mainlink1" href="">Events</a><br>
<a class="mainlink mainlink2" href="">Home Page Teaser</a><br>
<a class="mainlink mainlink3" href="">Testimonials</a><br>
<a class="mainlink mainlink4" href="">Repertoire</a><br>
|
by: michael |
last post by:
Is it possible to get all href URLs contained in a unordered list and place
them in an array?
Or in fact two different arrays, differently named one for each <ul> group?
<ul>
<li><a href="lemurs.html">Lemurs</a></li>
<li><a href="chameleons.html">Chameleons</a></li>
</ul>
<ul>
|
by: jmaxsherkimer |
last post by:
the site we're working on has some anchor links, you click them they
scroll to the bottom of the page with the answers to the questions
linked on to. is there anyway to make it so that the links are not
underlined when the page loads, when the user moves the mouse over
it's underlined, mouse out no underline. i tried:
<a href="#section14" class="drkblue08bold"
style="text-decoration:none">
but that left the underline gone forever,...
| |
by: MS Development |
last post by:
Hello Newgroup,
I'm new to ASP.NET and its nice navigation features. I have now some
problems with them which I hope can anyone solve. So here we go:
The generel idea is I have a page like e. g. eBay. On the eBay site you have
a "My eBay" Link in the top menu navigation. If you click on this link you
enter the member section where you can manage all your details. The member
section is further divided into sub sections like "Personal...
|
by: imtmub |
last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted.
Check this page for reference.
http://www.marco.com.cn/web-content/marco_re10.html
--------------------------------------------------------------
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Marco</title>
<!-- InstanceEndEditable -->
|
by: Mark B |
last post by:
I want to create a top navigation bar:
Home Products Services About Contact
I have been trying to use web.sitemap as the source for a menu control as
show in the example:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap>
|
by: Mateusz Viste |
last post by:
Hi,
I'm not sure if my question is really related to JavaScript, so please excuse me if that's not the case (and maybe you guys would have an idea what's the cause is and where could I ask)...
I recently put the following script online:
<script type="text/javascript"><!--
function playmedia(mediafile) {
newwindow=window.open();
if (window.focus) {newwindow.focus()}
newwindow.document.write('<html>');
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |