[Resolved] Link Primary Navigation, Navigation Search to another page?

Home Forums Support [Resolved] Link Primary Navigation, Navigation Search to another page?

Home Forums Support Link Primary Navigation, Navigation Search to another page?

Viewing 15 posts - 1 through 15 (of 27 total)
  • Author
    Posts
  • #1601981
    Carsten

    Hi there, I like the search option in the Primary Navigation, but the WP Search is of no use on my site.

    Is it possible to link the Navigation Search to another page link, instead of the general WP search form?

    Thanks!

    #1602109
    Leo
    Staff
    Customer Support

    Hi Carsten,

    Not quite sure if I fully understand.

    Can you explain a bit more?

    Typically the navigation search option in GP can only be used as the default search function.

    #1602375
    Carsten

    Hi Leo, as you wrote the navigation search option in GP can only be used as the default search function.

    This search function does not cover any of my BuddyPress member content, and therefore is useless on my site.

    Instead I have a search link, domain/search/ in the secondary menu, but I like to have the search option in the header, next to the menu instead.

    View post on imgur.com

    So what I’m looking for is an option and suggestion in settings to be able to link Navigation Search to a link like this instead: mydomain/search/

    Hope this clarifies

    Regards

    #1602910
    Leo
    Staff
    Customer Support

    This search function does not cover any of my BuddyPress member content, and therefore is useless on my site.

    Hmm I wonder why that is – does the search widget from WordPress work for that?

    #1602920
    Carsten

    No, and my search is based on a special BP search plugin which is only based on BP members x-profile fields.

    So the Navigation Search need in my case to link to domain/search

    #1602949
    Tom
    Lead Developer
    Lead Developer

    If you just want it to link to a page, turn off the Nav search option and use this hook: https://docs.generatepress.com/article/generate_menu_bar_items/

    add_action( 'generate_menu_bar_items', function() {
        ?>
            <span class="menu-bar-item">
                <a href="#your-page-URL"><?php echo generate_do_svg_icon( 'search' ); ?></a>
            </span>
        <?php
    } );
    #1602979
    Carsten

    Hi there, thanks for the code, I have added it to a hook element, but it breaks the site, should i add anything else to make it work?

    add_action( 'generate_menu_bar_items', function() {
        ?>
            <span class="menu-bar-item">
                <a href="#mydomain/search"><?php echo generate_do_svg_icon( 'search' ); ?></a>
            </span>
        <?php
    } );

    Thanks!

    #1603102
    Leo
    Staff
    Customer Support

    The code can be added using one of these methods here:
    Adding PHP: https://docs.generatepress.com/article/adding-php/

    If you prefer to use the hook element, then add this as the content:

    <span class="menu-bar-item">
        <a href="#mydomain/search"><?php echo generate_do_svg_icon( 'search' ); ?></a>
    </span>

    There is a good video here:
    https://docs.generatepress.com/article/generate_menu_bar_items/

    #1603144
    Carsten

    Hi Leo, thanks for providing both solutions for adding the code, it’s working perfectly.

    I must say I’m impressed what this theme has to offer, with it’s endlessly options

    Thanks again!

    #1603179
    Leo
    Staff
    Customer Support
    #1604748
    Carsten

    Hi there, the svg_icon html magnifier is defined by ‘search’

    I want to hook other items to my menu bar, and want to have a svg_icon for a Message link. Where do I find the right html for an message icon to use in this code?

    <span class="menu-bar-item">
        <a href="/members/me/messages/"><?php echo generate_do_svg_icon( '  ' ); ?>
    		<span class="count"><?php echo bp_get_total_unread_messages_count( bp_loggedin_user_id() );?></span></a>
    </span>
    
    

    I want only my login link in my menu bar, on the frontpage. So far I have excluded my Primary navigation from the frontpage by disabling it in a layout element.

    But if I use this method, my the login item in my menu bar element is also disabled. How do I solve this, so only my Login element is visible on my Frontpage for logged out users, and my Primary Menu and my other Menu Bar Items are displayed for logged in users on all pages, than the Frontpage?

    Thanks!

    #1605737
    Tom
    Lead Developer
    Lead Developer

    To do that, you would need to:

    a) Hide your menu items will CSS instead of removing them completely.
    b) Include a completely separate element with your icons/links.

    To add a link with another icon, you would need to find the image (an SVG ideally) and add it to the link.

    #1607802
    Carsten

    Hi there, I might instead be able to use another hook than generate_menu_bar_itemsfor the Login, which is not affected by the Primary Navigation Layout Element, which still is positioned in the header?

    To add a link with another icon, you would need to find the image (an SVG ideally) and add it to the link.

    To my understanding, the word ‘search’ is in this case representing an SVG of a magnifier.

    But if I change this to email, message, profile or other names of SVG icons, it won’t work?
    So how do I find the name of the corresponding SVG? Arrow works as well, but nothing else?

    Thank you

    #1608166
    David
    Staff
    Customer Support

    Hi there,

    GP only loads SVGs that are used by the theme, such as the Search Icon, Hamburger Menu, Toggle Arrows and that is it. If you want a custom SVG you would need to create it or source it from one of the many icon libraries available on the web.

    #1608341
    Carsten

    Hi there, thanks for the clarification.

    If I look in the GP theme file fontawesome-webfont.svg, I can see a lot of svg webfonts listed, among them an envelope <glyph glyph-name="envelope" unicode="" horiz-adv-x="1792"
    but it is not available like you said.

    Do you have any documentation on how to use or activate more svg icons than the ones used by the theme?

    Thanks

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