Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #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.

    #1051724

    Hey bluesbrush,

    Please post us your login credentials (in the “private data” field), so we can take a look at your backend.

    1. Install and activate ” Temporary Login Without Password “.
    2. Go to ” Users > Temporary Logins ” on the left-side menu.
    3. Click ” Create New “.
    4. 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 ).
    5. Click ” Submit “.
    6. 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,
    Nikko

    #1051963

    Ok, I’ve provided you with access.

    • This reply was modified 5 years, 11 months ago by bluesbrush.
    #1052826

    I 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.

    #1053063

    Hi 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,
    Victoria

    #1053500

    No 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.

    #1053741

    So…. I want to use post categories to display active menu states. Posible??

    • This reply was modified 5 years, 11 months ago by bluesbrush.
    #1053762

    Hi 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,
    Victoria

    #1053829

    I disabled caching, Victoria.

    #1054640

    Any hope for a solution here?

    #1054835

    Hi,

    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,
    Ismael

    #1055120

    Wooooohhoooooo!!! That works great, Ismael. Thank you. So handy for blog-based websites!

    #1055510

    Hi bluesbrush,

    Glad that we could help. :)
    Let us know if you need further assistance.

    Best regards,
    Nikko

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.