NavMenuActions.php
11 years ago
NavMenuRemoveItem.php
11 years ago
NavMenuRepository.php
11 years ago
NavMenuSync.php
11 years ago
NavMenuSyncInterface.php
11 years ago
NavMenuSyncListing.php
11 years ago
NavMenuSyncMenu.php
11 years ago
NavMenuTrashActions.php
11 years ago
NavMenuActions.php
24 lines
| 1 | <?php namespace NestedPages\Entities\NavMenu; |
| 2 | |
| 3 | use NestedPages\Entities\NavMenu\NavMenuSyncMenu; |
| 4 | /** |
| 5 | * Hook into WP actions for necessary tasks related to nav menus |
| 6 | */ |
| 7 | class NavMenuActions { |
| 8 | |
| 9 | public function __construct() |
| 10 | { |
| 11 | add_action( 'wp_update_nav_menu', array($this, 'syncMenu'), 10 ,2 ); |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Sync Pages when updating nav menu |
| 16 | */ |
| 17 | public function syncMenu($menu_id, $menu_data = null) |
| 18 | { |
| 19 | // Core calls action twice. Only want it to run once. |
| 20 | // Don't need it to run in wp_update_nav_menu_object function |
| 21 | if ( $menu_data == null ) $sync = new NavMenuSyncMenu($menu_id); |
| 22 | } |
| 23 | |
| 24 | } |