Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Help with CSS integration into wordpress Re: Help with CSS integration into wordpress

#81575
Kestral
Member

In the header you can have JavaScript parse the URL and determine what page their on, I’ve done this before (not in WordPress) with jQuery:

Code:
var loc = $("span#spc-loc").text();
var loc = loc.replace("/im/", "./").replace("/IM/", "./");
$("span#spc-loc").text(loc);

// To make it so the icons for each page shows correctly with the ? data this needs to be done. Forget switch()
// It won’t work here

$("#spc-loc:contains(‘index.php’)")
.parent()
.find(‘.home + .ico’)
.addClass(‘current’);
$("#spc-loc:contains(‘news.php’)")
.parent()
.find(‘.news + .ico’)
.addClass(‘current’);
$("#spc-loc:contains(‘about.php’)")
.parent()
.find(‘.about + .ico’)
.addClass(‘current’);
$("#spc-loc:contains(‘works.php’)")
.parent()
.find(‘.works + .ico’)
.addClass(‘current’);
$("#spc-loc:contains(‘/forum/’)")
.parent()
.find(‘.comm + .ico’)
.addClass(‘current’);

Where .spc-loc was:

Code:
<span id="spc-loc"><?php echo $path; ?></span>

Where $path was:

Code:
$path = $_SERVER[‘REQUEST_URI’];