Archived topic
Ubermenu problem with Generatepress
3 replies · Started by Gelu-Dănuț on April 5, 2020
Hello,
I try to insert this code in Snipest to make Ubermenu work in Generatepress Theme:
if ( ! function_exists( 'generate_navigation_position' ) ) {
function generate_navigation_position(){
if( function_exists( 'ubermenu' ) ){
ubermenu( 'main' , array( 'theme_location' => 'primary' ) );
}
}
}
/* Stop the theme from filtering the menu output */
add_action( 'wp_head' , 'stop_generatepress_menu_filter' );
function stop_generatepress_menu_filter(){
remove_filter( 'walker_nav_menu_start_el', 'generate_nav_dropdown', 10, 4 );
}
But i get this error:
"The snippet has been deactivated due to an error on line 3:
Cannot redeclare function generate_navigation_position."
Can you help me please?
Hi there,
Do you have any other functions that's already using the generate_navigation_position function?
Let me know :)
I honestly don't know where I can see if I have any other functions that’s already using the generate_navigation_position function. Can you help me with that? My site is https://dev.nmcromania.ro/.
Ahh I think what's the issue here.
I believe that code needs to be added in child theme's function.php (one of the rare case where Code Snippets wouldn't work).
Can you give that a shot?
https://docs.generatepress.com/article/using-child-theme/#installing-a-child-theme
https://docs.generatepress.com/article/adding-php/#use-a-child-theme
Let me know :)