function ml_menu_add_item_callback() { $title = $_POST['title']; $menu_type = $_POST['menu_type']; $cat_ID = $_POST['cat_ID']; $page_ID = $_POST['page_ID']; $url = $_POST['url']; if ($cat_ID == NULL || trim($cat_ID) == '0') { $cat_ID = NULL; } if ($page_ID == NULL || trim($page_ID) == '0') { $page_ID = NULL; } $item_ID = ml_home_menu_create_item($title, $menu_type, $page_ID, $cat_ID, $url); $item = ml_home_menu_get_item($item_ID); ml_home_menu_print_item($item); die; }
<p> </p> <div class='page'> <div class='page-id-select'> <select name="menu[page_id]"> <option>Select a page...</option> <?php foreach (get_pages() as $page) { echo "<option value='{$page->ID}'>{$page->post_title}</option>"; } ?> </select> </div> </div> <input type="text" name="menu[title]" placeholder="Title..."> <input type="submit" class='button action' value="Add"> </div> </div> <ul class="ml-home-menu"> <?php foreach (ml_home_menu_items() as $item) { ml_home_menu_print_item($item); } ?> </ul> <div class='ml-iphone5'> </div>