Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
Hi all,
highlighting the current page menu item is not working for me in the WP-Theme. Why is that?
I use the phplugins script:
// Add class "current_page_item" to menu item for the current page;
// You can style this as you like, for example, to highlight the current page menu item.
function scripts() {
echo <<<SCRIPT
<script>
$("ul.menu a[href='" + window.location.pathname + "']")
.parentsUntil('.menu', 'li')
.addClass("current_page_item")
;
</script>
SCRIPT;
return false;
} // END /**/
with the CSS:
a.current_page_item, .current_page_item a {
text-decoration: underline !important;
color: #ff8000 !important;
}
It works perfect with Backlight but has no effect on the WP Site
Any suggestions???
Thanks in advance.
Best regards,
Oliver
Offline
I think this is because the script hook does not reach into the WordPress structure. (Matt would have to confirm that)
But you should be able to add the functionality to WordPress via a plugin.
Or use a plugin that will allow you to add scripts.
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
The scripts hook is unavailable in Wordpress, due to how Wordpress handles the loading of Javascript. To use scripts in Wordpress, you need to enqueue them via a child theme. Here's how that works:
https://developer.wordpress.org/referen … ue_script/
Clear as mud? It's not me; blame WordPress.
Offline
Rod & Matt,
thank you very much for your help.
I better not try to use scripts in wordpress :-|
Best regards,
Oliver
Offline