alleyinteractive / alleyinteractive/wordpress-fieldmanager
Fields not appearing for newly added Menu Item (appearing after saving)
- Lingua principale
- PHP
- Stelle
- 563
- Fork
- 99
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### 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).
10. Expand the newly added menu item.
11. Check that fields are visible. (See Screenshot 3)
### Additional Information
### Screenshot 1

### Screenshot 2

### Screenshot 3

Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.