Conflict
-
i there!
I’m getting this in the top of the admin site:
Nav Menu Roles has detected a possible conflict with the following functions or classes: p.
I can not see the options in the menu.
How can I solve it?Thank you in advance!
-
Please see the FAQ
I’ve seen the FAQ, but I don’t know what to do.
Where I should put the code?Thank you!
You need to add that code to your theme’s (or conflicting plugin’s) “admin menu Walker”. I can’t know exactly where that is because it is different for every conflicting theme/plugin, which is why I don’t support fixing other themes and plugins to work with NMR.
The best thing to do is contact the other author and point him or her to the workaround described in the FAQ.
Ok, I wrote up the following to add to my FAQ eventually. It is intended to help walk you through patching your plugin/theme.
Patching Your Plugin/Theme
Should you wish to attempt this patch yourself, you can modify your conflicting plugin/theme’s admin menu Walker class.
1. Find the class that extends the
Walker_Nav_Menu. As a hint, it is filteringwp_edit_nav_menu_walkerand you might even be getting a warning about it from Nav Menu Roles. Example:add_filter( 'wp_edit_nav_menu_walker', 'sample_edit_nav_menu_walker'); function sample_edit_nav_menu_walker( $walker ) { return 'Walker_Nav_Menu_Edit_Roles'; // this is the class name }2. Find the file for the extending class. In my plugin this is in a file located at
inc/class.Walker_Nav_Menu_Edit_Roles.php. I can’t know *where* this file is in your plugin/theme. Please don’t ask me, but here’s what the beginning of that class will look like:class Walker_Nav_Menu_Edit_Roles extends Walker_Nav_Menu {}Note that the class name is the same as the class name you found in step 1.
3. Find the
start_el()methodIn that file you will eventually see a class method that looks like:
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {4. Paste my action hook somewhere in this method!
In Nav Menu Roles, I have placed the hook directly after the description, ex:
<p class="field-description description description-wide"> <label for="edit-menu-item-description-<?php echo $item_id; ?>"> <?php _e( 'Description' ); ?><br /> <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $item->description ); // textarea_escaped ?></textarea> <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?></span> </label> </p> <?php // Add this directly after the description paragraph in the start_el() method do_action( 'wp_nav_menu_item_custom_fields', $item_id, $item, $depth, $args ); // end added section ?>Hi !
First of all thank you very much for replying so fast.
Now I know the plugin is giving me the problem, is the UberMenu.
I’ve found the file where I should do the changes, and I tried to do it pasting the code you gave me:<?php
// Add this directly after the description paragraph in the start_el() method
do_action( ‘wp_nav_menu_item_custom_fields’, $item_id, $item, $depth, $args );
// end added section
?>After the start_el method like this:
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
// Add this directly after the description paragraph in the start_el() method
do_action( ‘wp_nav_menu_item_custom_fields’, $item_id, $item, $depth, $args );
// end added sectionAnd it almost works properly, because when I’m in the Menu page now I can see the options of your plugin but not where they should be placed.
Did I do something wrong?
See the images. First is like this:
http://imageshack.com/a/img633/9614/x135gM.pngThen it changes like this:
http://imageshack.com/a/img537/3674/iHRcKA.pngThank you very much!
Ok, finally I’ve got it !
It was my fault, I put the code in a wrong place.
Thank you very much for your attention!Ok, finally I’ve got it !
It was my fault, I put the code in a wrong place.
Thank you very much for your attention!could you be more detailed about in which “place” folder you put it ?
Every plugin and theme is different so I can’t know what folder to place my code patch in.
Hi There I found it!.. it was in the same method just before it ends. I’ve had found similar to code to the one provided then paste it after that code.. the last three lines if the code are already there; therefore, there is no need to add them again.
Thank you, helgatheviking for your reply and concern.
Can you plugin just work by itself?
Yes, the plugin works by itself and does not rely on any other plugin.
The topic ‘Conflict’ is closed to new replies.