Skip to content

Instantly share code, notes, and snippets.

@waltermesser
Created April 1, 2017 00:24
Show Gist options
  • Save waltermesser/f6ae43e53ad720fbba2f7be4d567288d to your computer and use it in GitHub Desktop.
Save waltermesser/f6ae43e53ad720fbba2f7be4d567288d to your computer and use it in GitHub Desktop.
add_action( 'wp_nav_menu_item_custom_fields', '_my_custom_nav_menu_fields', 10, 4 );
function _my_custom_nav_menu_fields( $item_id, $item, $depth, $args ) {
wp_nonce_field( 'pum-menu-editor-nonce', 'pum-menu-editor-nonce' ); ?>
<p class="field-popup_id description description-wide">
<label for="edit-menu-item-popup_id-<?php echo $item->ID; ?>">
<?php _e( 'Trigger a Popup', 'popup-maker' ); ?><br />
<select name="menu-item-pum[<?php echo $item->ID; ?>][popup_id]" id="edit-menu-item-popup_id-<?php echo $item->ID; ?>" class="widefat edit-menu-item-popup_id">
<option value=""></option>
<?php foreach ( PUM_Modules_Menu::popup_list() as $option => $label ) : ?>
<option value="<?php echo $option; ?>" <?php selected( $option, $item->popup_id ); ?>>
<?php echo esc_html( $label ); ?>
</option>
<?php endforeach; ?>
</select>
<span class="description"><?php _e( 'Choose a popup to trigger when this item is clicked.', 'popup-maker' ); ?></span>
</label>
</p>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment