Site logo

Archived topic

How to add shortcode into navigation

6 replies · Started by Blake on May 10, 2017

Viewing posts 1–7 of 7

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.

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.

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!

This archived topic is closed to new replies.