Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields not appearing for newly added Menu Item (appearing after saving) #879

Open
eduayala opened this issue Sep 18, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@eduayala
Copy link

eduayala commented Sep 18, 2024

Description of the bug

Context for Menu Item (class-fieldmanager-context-menuitem.php) is not working properly. I would expect to see the fields when a new Menu Item is added to a Menu in Appearance -> Menus without the need to save the menu to refresh the page, but instead I need to save the menu, reloading the page and only then the fields appears for the newly added Menu Item.

Steps To Reproduce

Requirements:

  1. WordPress and FieldManager 1.6.1 installed.
  2. Add Menus support to the theme add_theme_support( 'menus' );.
  3. Add a menu with some menu items inside.
  4. Add the code below to your functions.php file to add some fields to Menu Item.
add_action( 'fm_nav_menu', 'fm_expanded_menu_fields' );

function fm_expanded_menu_fields() {
	$fm = new Fieldmanager_Group( array(
    		'name' => 'contact_information',
    		'children' => array(
      			'name' => new Fieldmanager_Textfield( 'Name' ),
      			'phone' => new Fieldmanager_Textfield( 'Phone Number' ),
      			'website' => new Fieldmanager_Link( 'Website' ),
    		),
  	) );
	$fm->add_nav_menu_fields();
}

Steps:

  1. Go to Appearance -> Menus.
  2. Select the menu you've created.
  3. Expand any existing menu item.
  4. Check that fields are visible. (See Screenshot 1)
  5. Add a new item to the menu a Custom Link for this example.
  6. Expand the newly added menu item.
  7. Check that fields are not visible. (See Screenshot 2)
  8. Save the menu (the page will reload).
  9. Expand the newly added menu item.
  10. Check that fields are visible. (See Screenshot 3)

Additional Information

Screenshot 1

Screenshot 2024-09-18 at 16-02-46 Menus ‹ MIT Technology Review — WordPress

Screenshot 2

Screenshot 2024-09-18 at 16-03-46 Menus ‹ MIT Technology Review — WordPress

Screenshot 3

Screenshot 2024-09-18 at 15-52-22 Menus ‹ MIT Technology Review — WordPress

@eduayala eduayala added the bug Something isn't working label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant