function dt_metabox_catalog_layout_category($post) { $box_name = 'dt_catalog_layout_category'; $defaults = array('select' => 'all', 'catalog_cats' => array()); $opts = get_post_meta($post->ID, '_' . $box_name, true); $opts = wp_parse_args(maybe_unserialize($opts), $defaults); // Use nonce for verification wp_nonce_field(plugin_basename(__FILE__), $box_name . '_nonce'); $terms = get_terms('dt_catalog_category', array('hide_empty' => true, 'hierarchical' => false, 'pad_counts' => false)); $select = array('all' => array('desc' => 'All'), 'only' => array('desc' => 'only'), 'except' => array('desc' => 'except')); $links = array(array('href' => get_admin_url() . 'post-new.php?post_type=dt_catalog', 'desc' => _x('Add new catalog item', 'backend catalog layout', LANGUAGE_ZONE)), array('href' => get_admin_url() . 'edit.php?post_type=dt_catalog', 'desc' => _x('Edit catalog', 'backend catalog layout', LANGUAGE_ZONE)), array('href' => get_admin_url() . 'edit-tags.php?taxonomy=dt_catalog_category&post_type=dt_catalog', 'desc' => _x('Edit catalog categories', 'backend catalog layout', LANGUAGE_ZONE))); $text = array('header' => sprintf('<h2>%s</h2><p><strong>%s</strong>%s</p><p><strong>%s</strong></p>', _x('ALL your Catalog items are being displayed on this page!', 'backend', LANGUAGE_ZONE), _x('By default all your Catalog items will be displayed on this page.', 'backend', LANGUAGE_ZONE), _x('But you can specify which Catalog category(s) will (or will not) be shown.', 'backend', LANGUAGE_ZONE), _x('In tabs above you can select from the following options:', 'backend', LANGUAGE_ZONE)), 'select_desc' => array(_x(' — all Catalog items will be shown on this page.', 'backend', LANGUAGE_ZONE), _x(' — choose Catalog category(s) to be shown on this page.', 'backend', LANGUAGE_ZONE), _x(' — choose which Catalog category(s) will be excluded from displaying on this page.', 'backend', LANGUAGE_ZONE)), 'info_desc' => array(_x('%d items', 'backend', LANGUAGE_ZONE))); dt_core_mb_draw_modern_selector(array('box_name' => $box_name, 'cats_name' => $box_name . '_catalog_cats[%d]', 'links' => $links, 'terms' => $terms, 'albums_cats' => $opts['catalog_cats'], 'cur_type' => 'category', 'cur_select' => $opts['select'], 'text' => $text, 'maintab_class' => 'dt_all_catalog')); }
function dt_metabox_slider_layout_slideshows($post) { $box_name = 'dt_slider_layout_slideshows'; global $wpdb; $defaults = array('select' => 'all', 'slideshows' => array()); $opts = get_post_meta($post->ID, '_' . $box_name, true); $opts = wp_parse_args(maybe_unserialize($opts), $defaults); // Use nonce for verification wp_nonce_field(plugin_basename(__FILE__), $box_name . '_nonce'); $select = array('all' => array('desc' => 'All'), 'only' => array('desc' => 'only'), 'except' => array('desc' => 'except')); $links = array(array('href' => get_admin_url() . 'post-new.php?post_type=dt_slider', 'desc' => _x('Add new slideshow', 'backend slider layout', LANGUAGE_ZONE)), array('href' => get_admin_url() . 'edit.php?post_type=dt_slider', 'desc' => _x('Edit slideshows', 'backend slider layout', LANGUAGE_ZONE))); // dt_core_mb_draw_radio_switcher( $box_name . '_select', $opts['select'], $select ); // echo '<input type="hidden" name="' . $box_name . '_select" value="' . $opts['select'] . '"/>'; $text = array('header' => sprintf('<h2>%s</h2><p><strong>%s</strong>%s</p><p><strong>%s</strong></p>', _x('ALL your Slideshows are being displayed on this page!', 'backend', LANGUAGE_ZONE), _x('By default all your Slideshows will be displayed on this page. ', 'backend', LANGUAGE_ZONE), _x('But you can specify which Slideshows will (or will not) be shown.', 'backend', LANGUAGE_ZONE), _x('In tabs above you can select from the following options:', 'backend', LANGUAGE_ZONE)), 'select_desc' => array(_x(' — all Slideshows will be shown on this page.', 'backend', LANGUAGE_ZONE), _x(' — choose Slideshow(s) to be shown on this page.', 'backend', LANGUAGE_ZONE), _x(' — choose which Slideshow(s) will be excluded from displaying on this page.', 'backend', LANGUAGE_ZONE)), 'info_desc' => array(_x('%d slideshows', 'backend', LANGUAGE_ZONE), _x('%d slides total', 'backend', LANGUAGE_ZONE))); $slideshows = new Wp_Query('post_type=dt_slider&posts_per_page=-1&post_status=publish'); dt_core_mb_draw_modern_selector(array('box_name' => $box_name, 'albums_name' => $box_name . '_slideshows[%d]', 'links' => $links, 'posts' => $slideshows->posts, 'albums' => $opts['slideshows'], 'cur_type' => 'albums', 'cur_select' => $opts['select'], 'text' => $text, 'maintab_class' => 'dt_all_sliders')); /* // get slideshows dt_core_mb_draw_posts_list( $box_name . '_slideshows[%d]', $opts['slideshows'], $slideshows->posts ); dt_core_mb_draw_functional_links( $links ); */ }