[Support request] Sticky Secondary Menu instead of Primary Menu

Home Forums Support Sticky Secondary Menu instead of Primary Menu

Viewing 15 posts - 1 through 15 (of 30 total)
  • Author
    Posts
  • #342213
    Abdul Rehman

    Hi
    How can I create sticky secondary navigation instead of primary? I can’t switch the settings to make primary secondary and secondary primary one, since I am using navigational logo…

    GeneratePress 1.3.48
    #342221
    Leo
    Staff
    Customer Support

    Hi there,

    I would switch the settings so that the one you want sticky is the primary and then just add the navigation logo using GP hooks:
    https://docs.generatepress.com/article/generate_inside_secondary_navigation/

    Something like this:

    add_action( 'generate_inside_secondary_navigation','lh_secondary_navigation_logo' );
    function lh_secondary_navigation_logo() {
    ?>
        <div class="secondary-navigation-logo">
            <img src="URL TO NAVIGATION LOGO" alt="" />
        </div>
    <?php
    }
    #342597
    Abdul Rehman

    I did not get the process. Can you please explain it in more detial?

    #342600
    Leo
    Staff
    Customer Support

    In your original post, you mentioned that the setting cannot be switched since you are using navigation logo in primary navigation.

    So the method above adds a navigation logo to secondary navigation so you can switch the setting.

    Let me know if this makes sense.

    #342601
    Abdul Rehman

    I understood this part. I just don’t know how to use the hooks. Where to insert the code etc

    #342603
    Abdul Rehman

    When I go to the hooks section, there are lots of windows. In which window should I insert the code?

    #342604
    Abdul Rehman

    I am already using this CSS. Shall I remove it?

    .site-header {
    display: none;
    }

    .main-navigation .sticky-logo,
    .main-navigation .sticky-logo img {
    width: auto;
    }

    /* Navigation logo */
    .main-navigation .sticky-logo,
    .main-navigation .sticky-logo img {
    height: 55px;
    }

    .main-navigation .navigation-logo {
    padding-left: 70px;

    }

    .main-navigation
    padding-top: 100px;

    #342605
    Leo
    Staff
    Customer Support

    That hook is actually not in the hooks module so add it as a snippet: https://docs.generatepress.com/article/adding-php/#code-snippets

    You can keep that CSS for now. Might help adjusting the CSS once you add the logo into the secondary navigation.

    #342611
    Abdul Rehman

    Ok. I added code in functions.php file in my child theme. But I can’t see any new hook category in hooks section.

    #342622
    Abdul Rehman

    What should I do next?

    #342653
    Leo
    Staff
    Customer Support

    The code acts as the hook. If you replace URL TO NAVIGATION LOGO by the actual URL then it should show up.

    #342654
    Abdul Rehman

    actual URL here means?

    #342655
    Leo
    Staff
    Customer Support

    URL of your logo image.

    #342656
    Abdul Rehman

    I put the URL of logo image. Still no new category visible in the hooks. By what name does new category appear?

    #342657
    Abdul Rehman

    I am already using this function

    add_filter( ‘generate_logo_href’,’generate_custom_logo_href’ );
    function generate_custom_logo_href()
    {
    // Enter the URL you want your logo to link to below
    return ‘http://www.elearnee.com&#8217;;
    }

    Is this code interfering?

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