Archived topic
How to add shortcode into navigation
6 replies · Started by Blake on May 10, 2017
I am having issues adding a beaver builder short code into the navigation menu. Currently I am using the following hook:
add_action( 'generate_inside_navigation','addnavshortcode' );
function addnavshortcode() { ?>
[fl_builder_insert_layout slug="header1"]
<?php }
The goal is to add beaver builder elements within the navigation tag above and below the menu listing.
Hi Blake,
This might help: https://generatepress.com/forums/topic/shortcode-assigned-to-menu-custom-link/#post-235400
Thank you for the reply. The plugin that accomplishes this task is over 2 years old. To accomplish the task described above I was hoping this could be solved by inputting a small snippet of code through the Generatepress hook system. If this can be accomplished can I please receive assistance. If it is not possible an explanation of why would be very helpful.
Can you try using the method here to execute the shortcode?
https://generatepress.com/forums/topic/gp-and-beaver-builder-shortcodes-and-hooks/#post-216608
Let me know.
Thank you for the help. I incorporated the do_shortcode function as you suggested into my hook function. Now it works.
<?php
add_action( 'generate_inside_navigation','addnavshortcode' );
function addnavshortcode() {
echo do_shortcode( '[fl_builder_insert_layout slug="header1"]' );
}
?>
Thanks for the question :)
Glad I could help!
Good job i'm trying in my web site lucasarias.com