Tagged: active menu item
-
AuthorPosts
-
January 7, 2019 at 10:22 pm #1051063
On this site, (susansdaniels.com), post categories are loaded into the journal page:
susansdaniels.com/journal/One of the post categories (events) is displayed on this page: susansdaniels.com/events/
As soon as one of the “events” are clicked, the “journal” menu item looks active. I understand why this would happen but I don’t know how to trick it into displaying the “events” page as active when viewing a post categorized as “event”.
I do understand there are event plugins for this sort of thing but I’d like to try to solve this without another plugin, if possible.
January 9, 2019 at 11:15 am #1051724Hey bluesbrush,
Please post us your login credentials (in the “private data” field), so we can take a look at your backend.
- Install and activate ” Temporary Login Without Password “.
- Go to ” Users > Temporary Logins ” on the left-side menu.
- Click ” Create New “.
- Add the email address for the account ( you can use (Email address hidden if logged out) ), as well as the ” Role ” making that the highest possible and the expiry about four days
( do be sure that we have enough time to debug ). - Click ” Submit “.
- You’ll now have a temporary account. Please provide us here in the private section the URL, so we can login and help you out.
When your issue is fixed, you can always remove the plugin!
If you prefer to not use the plugin, you can manually create a admin user and post the login credentials in the “private data” field.Best regards,
NikkoJanuary 9, 2019 at 5:57 pm #1051963Ok, I’ve provided you with access.
- This reply was modified 5 years, 11 months ago by bluesbrush.
January 11, 2019 at 6:09 pm #1052826I removed the words “thank you” from my last reply. I didn’t want to imply that this has been resolved. Still trying to figure this out.
January 12, 2019 at 1:58 pm #1053063Hi bluesbrush,
https://cl.ly/98921573be66 Do you mean the active and the hover states for the links are the same? Is this what you need to change or?
Could you please attach some screenshots of the issue?
Best regards,
VictoriaJanuary 14, 2019 at 3:56 am #1053500No Victoria. I’m using blog to display events but also to for journal page. I want the events tab to be highlighted when viewing an event. Here is an “event”: https://susansdaniels.com/book-signing-at-revelations-cafe-and-bookstore/
Notice that “journal” is highlighted instead of “events”. Again, I understand why this is happening but I want to override the default behavior and highlight “events” when that post category is checked. I suspect I may have adjust permalinks along with whatever solution your team can provide.
January 14, 2019 at 6:04 pm #1053741So…. I want to use post categories to display active menu states. Posible??
- This reply was modified 5 years, 11 months ago by bluesbrush.
January 14, 2019 at 6:32 pm #1053762Hi bluesbrush,
Well, with the way menu works now, even the “Journal” menu item should not be highlighted.
I want to use post categories to display active menu states.
– no, not really, not out of the box.
Can you disable caching and minification for now?
Best regards,
VictoriaJanuary 14, 2019 at 8:04 pm #1053829I disabled caching, Victoria.
January 16, 2019 at 6:43 pm #1054640Any hope for a solution here?
January 17, 2019 at 4:04 am #1054835Hi,
This script should set the “Events” menu item as the current menu item when the current post belong to the “event” category.
add_action('wp_footer', 'ava_script_set_events_menu_item', 9999); function ava_script_set_events_menu_item() { ?> <script> (function() { const single = document.querySelector('.single'); const categories = document.querySelectorAll('.blog-categories a'); const journal = document.querySelector('#menu-item-1152'); const events = document.querySelector('#menu-item-1661'); let event = null; if( ! single ) return; for (i = 0; i < categories.length; ++i) { if( categories[i].textContent == 'events' ) { event = categories[i]; } } if( event ) { journal.classList.remove('current-menu-item'); events.classList.add('current-menu-item'); } })(); </script> <?php }
Just add it in the functions.php file.
Best regards,
IsmaelJanuary 17, 2019 at 6:52 pm #1055120Wooooohhoooooo!!! That works great, Ismael. Thank you. So handy for blog-based websites!
January 18, 2019 at 4:57 pm #1055510Hi bluesbrush,
Glad that we could help. :)
Let us know if you need further assistance.Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.