Site logo

[Resolved] CTA button on menu item

Home Forums Support [Resolved] CTA button on menu item

Home Forums Support CTA button on menu item

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1907307
    Lynn

    Hi there,
    I used the css code on the following page – https://docs.generatepress.com/article/adding-buttons-navigation/ to add a button to one of the menu items in my primary navigation. It worked great. However, when I added sub menus to that menu item, a CTA button got added to each of the sub-menu items (please see http://www.arnpriorhumanesociety.ca/new-website/). I don’t want this. How can I have a button just on the parent item?

    Thanks in advance for your advice.

    Lynn

    #1907310
    Leo
    Staff
    Customer Support

    Hi there,

    Edit your CSS selector to this:
    .main-navigation .main-nav ul > li.nav-button > a

    #1907415
    Lynn

    Thanks Leo. That works great.

    #1908242
    Leo
    Staff
    Customer Support

    No problem 🙂

    #2340527
    Arnaud

    Leo –

    https://wordpress-834202-2871905.cloudwaysapps.com/

    I would like the CTA button in the primary navigation to look exactly the same as the CTA in the home hero section (Prdnre RDV with the icon).

    What is the best solution ?

    thx

    #2340741
    David
    Staff
    Customer Support

    Hi there,

    for that button it would be easier to not use the CSS method.

    Instead;

    1. Create a New Block Element in Appearance > Elements:

    https://docs.generatepress.com/article/block-element-hook/

    2. Add your GB Button to the block editor.

    2.1 With the Buttons block selected, in Advanced > Additional CSS Class(es) you can use the GP hide-on-* classes if you wish to hide the button on different devices:

    https://docs.generatepress.com/article/responsive-display/#using-our-hide-on-classes

    3. Set the Hook to menu_bar_items

    4. Set the Display Rules.

    This way you can style the button exactly the same way as your other button

    #2340785
    Arnaud

    that works. thx

    How can we add the same CTA into the mobile menu ?

    thx

    #2340849
    Ying
    Staff
    Customer Support

    Do you want it to show along with the hamburger icon or do you want it to show with the other menu items by clicking the hamburger icon on mobile?

    #2340876
    Arnaud

    to show with the other menu items by clicking the hamburger icon on mobile

    thx Ying

    #2340917
    Ying
    Staff
    Customer Support

    In that case, this solution would do: https://docs.generatepress.com/article/adding-buttons-navigation/

    You just need to add hide-on-destop class along with the nav-button class, so it won’t display on the desktop.

    #2342931
    Arnaud

    https://wordpress-834202-2871905.cloudwaysapps.com/

    i find a little issue.
    By hiding on mobile the CTA button on the navigation, it’s also hide the CTA button on the hero section.

    I want to CTA button on the hero section.

    https://snipboard.io/wXg1W6.jpg
    https://snipboard.io/ENlsCF.jpg

    what is the solution ?
    plz.

    #2342994
    Ying
    Staff
    Customer Support

    It’s because the 2 buttons blocks are using the same ID.

    GB generates CSS (style) based on IDs, when the 2 blocks are sharing the same ID, their style will override each other.

    The solution is easy, go to the hero section, select the buttons block, duplicate it and delete the original one.

    The difference between duplicate and copy/paste is that duplicate generates a new set of ID for the new blocks, while copy/paste doesn’t.

    Hope that’s clear 🙂

    #2343330
    Arnaud

    thx

    #2343336
    Ying
    Staff
    Customer Support

    No problem 🙂

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