Site logo

Archived topic

SVG or FA icons in menu located in main content

11 replies · Started by bjbowen on April 22, 2022

Viewing posts 1–12 of 12

Goal: Have an Icon with drop-down list of email (and phone) for two separate locations (US and Canada)

What I've tried:
1. created a navigation block
2. created a menu (exactly as I have it for the Secondary Nav -- and it works properly there.)
3. The icons display in the admin, but not on the public side (only the svg down arrows display)

I can't figure out why it works in the Secondary Nav location, but will not display in the Navigation block.

https://first.alfiniti.net/about-alfiniti/

The Contact Box Navigation should appear in the hero section "Contact us with any questions"

Hi there,

the Nav block is stripping that HTML out on the front end - how are the icons being added to the Nav Block ?

<i class="fas fa-paper-plane"></i> in the Navigation Label of the menu

That's exactly the way it's set up for the Secondary Nav.

Is there a better way to achieve what we're trying to do?

I've created another menu called "Contact Box" that uses a paper plane instead of the envelope. How would I edit that shortcode snippet to pull that menu?

You edit the Contact Box menu, and set its Location to the Secondary Navigation

Then that would replace the Secondary Nav.

I have found a work around.

Probably just should have built it with html, buttons and hover effects. This was nuts. Thanks for your help though.

Glad to hear you found a solution.

Hey there... Jumping back to this.

I have the shortcode that pulls the Secondary Navigation and it works perfectly.

But, I need to pull another menu. That menu name is Contact Box.

How would I modify this code so I can call the Contact Box menu with a shortcode:

/* add navigation inside page using shortcode - All contact bars use this */

add_shortcode( 'secondary_navigation', function() {
ob_start();

if ( function_exists( 'generate_secondary_navigation_position' ) ) {
generate_secondary_navigation_position();
}

return ob_get_clean();
} );

You can see why I need to do this by looking at this page: https://first.alfiniti.net/services/

The top bar has the Secondary Menu and that's exactly what I want.

The Contact Box (Just after the main paragraph "Contact us with any questions") doesn't need the Language Switcher, only the contact options. I know I could do this with CSS, but would like a more elegant solution.

Thank you David!

The Navigation Block is stripping the classes (as you noted earlier).

Now, I have registered a custom menu location, and am using a shortcode to display that menu. I'm not a developer, so there's that, but it's working. Now I just have to style it.

I thought there might be an easier way (and yes the Navigation Block would have been ideal, but it stripped my classes!! Can't find an answer to that.)

I tested that Navigation Block issue on the 2022 WP Theme, and it doesn't work there either. So at least we know it's not a GP/GB issue.

I'll get this menu styled and not worry about it any more.

I think your current shortcode method and to throw some CSS at it, would be the best solution. Otherwise its a lot of code just to remove a language switcher

This archived topic is closed to new replies.