__('Gallery', 'gdl_back_office'), 'singular_name' => __('Gallery Item', 'gdl_back_office'), 'add_new' => __('Add New', 'gdl_back_office'), 'add_new_item' => __('Add New Gallery', 'gdl_back_office'), 'edit_item' => __('Edit Gallery', 'gdl_back_office'), 'new_item' => __('New Gallery', 'gdl_back_office'), 'view_item' => '', 'search_items' => __('Search Gallery', 'gdl_back_office'), 'not_found' => __('Nothing found', 'gdl_back_office'), 'not_found_in_trash' => __('Nothing found in Trash', 'gdl_back_office'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => 5, "show_in_nav_menus" => false, 'exclude_from_search' => true, 'supports' => array('title','thumbnail','custom-fields') ); register_post_type( 'gdl-gallery' , $args); } $gallery_meta_box = array( "Gallery Picker" => array( 'type'=>'gallerypicker', 'title'=> __('SELECT IMAGES', 'gdl_back_office'), 'xml'=>'post-option-gallery-xml', 'name'=>array( 'image'=>'post-option-inside-thumbnail-slider-image', 'title'=>'post-option-inside-thumbnail-slider-title', 'link'=>'post-option-inside-thumbnail-slider-link', 'linktype'=>'post-option-inside-thumbnail-slider-linktype'), 'hr'=>'none' ) ); add_action('add_meta_boxes', 'add_gallery_option'); function add_gallery_option(){ add_meta_box('gallery-option', __('Gallery Option','gdl_back_office'), 'add_gallery_option_element', 'gdl-gallery', 'normal', 'high'); } function add_gallery_option_element(){ global $post, $gallery_meta_box; echo '
'; ?> '; } function save_gallery_option_meta($post_id){ global $gallery_meta_box; $edit_meta_boxes = $gallery_meta_box; // save foreach ($edit_meta_boxes as $edit_meta_box){ // save function for slider if( $edit_meta_box['type'] == 'gallerypicker' ){ if(isset($_POST[$edit_meta_box['name']['image']])){ $num = sizeof($_POST[$edit_meta_box['name']['image']]) - 1; }else{ $num = -1; } $slider_xml_old = get_post_meta($post_id,$edit_meta_box['xml'],true); $slider_xml = ""; for($i=0; $i<=$num; $i++){ $slider_xml = $slider_xml. ""; $image_new = stripslashes($_POST[$edit_meta_box['name']['image']][$i]); $slider_xml = $slider_xml. create_xml_tag('image',$image_new); $linktype_new = stripslashes($_POST[$edit_meta_box['name']['linktype']][$i]); $slider_xml = $slider_xml. create_xml_tag('linktype',$linktype_new); $link_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['link']][$i])); $slider_xml = $slider_xml. create_xml_tag('link',$link_new); $slider_xml = $slider_xml . ""; } $slider_xml = $slider_xml . ""; save_meta_data($post_id, $slider_xml, $slider_xml_old, $edit_meta_box['xml']); }else{ if(isset($_POST[$edit_meta_box['name']])){ $new_data = stripslashes($_POST[$edit_meta_box['name']]); }else{ $new_data = ''; } $old_data = get_post_meta($post_id, $edit_meta_box['name'],true); save_meta_data($post_id, $new_data, $old_data, $edit_meta_box['name']); } } } // gallerypicker => title, name=>array(num,image,title,caption,link) function print_gallery_picker($args){ extract($args); ?>
' value=childNodes->length; ?> />

  • ' />
    ' />


  • childNodes as $slider){ ?>

  • []' id='[]' value="" />
    []' id='[]' value="" />