- This topic has 10 replies, 4 voices, and was last updated 6 years, 2 months ago by Leo.
-
AuthorPosts
-
February 6, 2018 at 2:54 pm #489912drew
I’ve been trying to integrate the ubermenu 3 plugin from Sevenspark per their integration guide here: http://sevenspark.com/docs/ubermenu-3/theme-integration/generatepress
I’ve discovered that attempts to insert the necessary functions via code snippets plugin is throwing errors. According to the devs at sevenspark, it requires using a child theme in order to override the pluggable function.
I’m not excited about the idea of creating a child theme expressly for using a single plugin and am wondering if you have any other suggestions on how to go about using those functions (perhaps working them in as a hook?).
Many thanks,
DrewFebruary 6, 2018 at 9:49 pm #490105TomLead DeveloperLead DeveloperWhat are the errors you’re encountering?
February 7, 2018 at 7:00 am #490452SimonYou really should be using a child theme, it bring other benefits too, like making customizations that survive a theme update.
You can place the following in your child theme ‘functions.php’. You may or may not need the inner ‘div’, I use it to allow a full width menu bar, but contain the menu items to the ‘contained width’ of the site:
/* Replace GeneratePress's main navigation menu with UberMenu */ function generate_navigation_position() { if (function_exists('ubermenu')) { echo '<div class="ubernav-container">'; echo '<div class="grid-container">'; ubermenu('main' , array('theme_location' => 'primary')); echo '</div>'; echo '</div>'; } }
February 7, 2018 at 7:07 am #490462drewThe error message is:
Cannot redeclare generate_navigation_position() (previously declared in
/nas/content/staging/morikami/wp-content/themes/generatepress/inc/structure/navigation.php:20)…and according to the plugin dev “you need to add the code in a child theme in order to override the pluggable function.”
I really want to avoid using a child theme, that was one of the primary features of using GP to begin with. Adding one now only erases part of the customizations already added so that only makes another tedious step of comparing each settings panel in the customizer to look for changes.
February 7, 2018 at 7:22 am #490477SimonYou might be able to put it in GP’s own functions.php, but it WILL be wiped out by a theme update.
February 7, 2018 at 7:24 am #490480drewMany thanks Simon, I’m well versed on all of that. What I’m looking for from Tom is to hopefully find a different solution.
February 7, 2018 at 12:01 pm #490698TomLead DeveloperLead DeveloperTheir code in the docs isn’t correct.
It should be:
if ( ! function_exists( 'generate_navigation_position' ) ) { function generate_navigation_position() { if( function_exists( 'ubermenu' ) ){ ubermenu( 'main' , array( 'theme_location' => 'primary' ) ); } } }
February 7, 2018 at 12:12 pm #490711drewGotcha and to confirm, using this in the snippet plugin should work, correct?
February 7, 2018 at 1:54 pm #490807LeoStaffCustomer SupportYup.
February 7, 2018 at 1:56 pm #490809drewAwesome, I will do that on my end plus forward this along to the ubermenu dev – thanks guys!
February 7, 2018 at 6:13 pm #490918LeoStaffCustomer SupportGlad we could help 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.