Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. if(!empty($_REQUEST['menu-item-custom-category'][$menu_item_db_id])) {
  2. delete_post_meta($menu_item_db_id, '_menu_item_custom_category');
  3. $values = $_REQUEST['menu-item-custom-category'][$menu_item_db_id];
  4. foreach($values as $value) {
  5. add_post_meta($menu_item_db_id, '_menu_item_custom_category', $value);
  6. }
  7. }
  8.  
  9. $item->custom_category = get_post_meta( $item->ID, '_menu_item_custom_content');
  10.  
  11. <p class="field-custom-category description description-thin">
  12. <label for="edit-menu-item-custom-category-<?php echo $item_id; ?>">
  13. <?php _e( 'Custom Categories' ); ?><br />
  14. <select name="menu-item-custom-category[<?php echo $item_id; ?>][]" id="edit-menu-item-custom-category-<?php echo $item_id; ?>" class="widefat code edit-menu-item-custom-category" multiple>
  15. <?php
  16. $YPE_cats = get_categories();
  17. foreach ($YPE_cats as $YPE_cat) { ?>
  18. <option value="<?php echo $YPE_cat->slug; ?>" <?php echo selected(in_array($YPE_cat->slug, $item->custom_category)); ?>><?php echo $YPE_cat->name;?></option><?php
  19. }
  20. ?>
  21. </select>
  22. </label>
  23. </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement