function dt_metabox_albums_layout_options($post = null) { $box_name = 'dt_albums_layout_options'; $defaults = array('layout' => '2_col-list', 'thumb_height' => '', 'ppp' => '', 'orderby' => 'date', 'order' => 'DESC', 'show_title' => 'on', 'show_grid_text' => 'on', 'show_excerpt' => 'on', 'show_all_pages' => 'off', 'show_cat_filter' => 'on', 'show_layout_swtch' => 'on', 'show_category' => 'on'); // if no post if (empty($post)) { return $defaults; } $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'); $layout = array('2_col-list' => array('desc' => _x('Two cols list', 'backend albums layout', LANGUAGE_ZONE), 'img' => array('list-2cols.png', 72, 49)), '2_col-grid' => array('desc' => _x('Two cols grid', 'backend albums layout', LANGUAGE_ZONE), 'img' => array('grid-2cols.png', 72, 49)), '3_col-list' => array('desc' => _x('Three cols list', 'backend albums layout', LANGUAGE_ZONE), 'img' => array('list-3cols.png', 72, 49)), '3_col-grid' => array('desc' => _x('Three cols grid', 'backend albums layout', LANGUAGE_ZONE), 'img' => array('grid-3cols.png', 72, 49))); $radio_on_off = array('on' => array('desc' => _x('on', 'backend albums layout', LANGUAGE_ZONE)), 'off' => array('desc' => _x('off', 'backend albums layout', LANGUAGE_ZONE))); $adv_opts = array('show_title' => array('desc' => _x('Show projects titles', 'backend portfolio layout', LANGUAGE_ZONE), 'ptrn' => $radio_on_off), 'show_excerpt' => array('desc' => _x('Show projects excerpts', 'backend portfolio layout', LANGUAGE_ZONE), 'ptrn' => $radio_on_off), 'show_category' => array('desc' => _x('Show projects categories', 'backend portfolio layout', LANGUAGE_ZONE), 'ptrn' => $radio_on_off), 'show_grid_text' => array('desc' => _x('Show text areas in grid layout', 'backend portfolio layout', LANGUAGE_ZONE), 'ptrn' => $radio_on_off), 'show_all_pages' => array('desc' => _x('Show all pages in paginator', 'backend portfolio layout', LANGUAGE_ZONE), 'ptrn' => $radio_on_off), 'show_cat_filter' => array('desc' => _x('Show categories filter', 'backend portfolio layout', LANGUAGE_ZONE), 'ptrn' => $radio_on_off), 'show_layout_swtch' => array('desc' => _x('Show layout switcher', 'backend portfolio layout', LANGUAGE_ZONE), 'ptrn' => $radio_on_off)); echo '<p><strong>' . _x('Albums layout', 'backend albums layout', LANGUAGE_ZONE) . '</strong></p>'; echo '<div class="dt_radio-img">'; foreach ($layout as $val => $data) { $image = ''; if (isset($data['img'])) { $image = sprintf('<img src="%1$s/%3$s" class="hide-if-no-js" width="%4$s" height="%5$s" style="background-image:url(%1$s/%2$s)" /><br />', esc_url(get_template_directory_uri() . '/images/admin'), esc_attr($data['img'][0]), 'blank.gif', $data['img'][1], $data['img'][2]); } echo dt_melement('radio', array('name' => $box_name . '_layout', 'description' => $data['desc'], 'checked' => $val == $opts['layout'] ? true : false, 'value' => $val, 'wrap' => '<label>' . $image . '%1$s %2$s</label>')); } echo '</div>'; echo '<div class="dt_hr"></div>'; echo '<p><strong>' . _x('Thumbnail height', 'backend albums layout', LANGUAGE_ZONE) . '</strong></p>'; echo dt_melement('text', array('name' => $box_name . '_thumb_height', 'description' => _x('(in pixels). If not specified, default value will be taken.', 'backend albums layout', LANGUAGE_ZONE), 'value' => $opts['thumb_height'], 'wrap' => '<p>%1$s <em>%2$s</em></p>')); echo '<div class="dt_hr"></div>'; echo dt_melement('text', array('name' => $box_name . '_ppp', 'description' => _x('Number of photo albums to display on one page', 'backend albums layout', LANGUAGE_ZONE), 'value' => $opts['ppp'], 'wrap' => '<p><strong>%2$s</strong></p><p>%1$s</p>')); echo '<div class="dt_hr"></div>'; echo '<p><strong>' . _x('Ordering settings', 'backend albums layout', LANGUAGE_ZONE) . '</strong></p>'; dt_core_mb_draw_order_options(array('box_name' => $box_name, 'order_current' => $opts['order'], 'orderby_current' => $opts['orderby'])); printf('<div class="hide-if-no-js"><div class="dt_hr"></div><p><a href="#advanced-options" class="dt_advanced"> <input type="hidden" name="%1$s" data-name="%1$s" value="hide" /> <span class="dt_advanced-show">%2$s</span> <span class="dt_advanced-hide">%3$s</span> %4$s </a></p></div>', 'dt_albums-advanced', _x('+ Show', 'backend albums layout', LANGUAGE_ZONE), _x('- Hide', 'backend albums layout', LANGUAGE_ZONE), _x('advanced settings', 'backend albums layout', LANGUAGE_ZONE)); echo '<div class="dt_albums-advanced dt_container hide-if-js"><div class="dt_hr"></div>'; $last_opt = end(array_keys($adv_opts)); foreach ($adv_opts as $name => $data) { echo '<p class="dt_switcher-box"><strong>' . $data['desc'] . '</strong>'; dt_core_mb_draw_radio_switcher("{$box_name}_{$name}", $opts[$name], $data['ptrn']); echo '</p>'; if ($last_opt == $name) { continue; } echo '<div class="dt_hr"></div>'; } echo '</div>'; }
/** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ function form($instance) { /* Set up some default widget settings. */ $instance = wp_parse_args((array) $instance, $this->dt_defaults); $p_orderby = array('ID' => _x('Order by ID', 'backend orderby', LANGUAGE_ZONE), 'author' => _x('Order by author', 'backend orderby', LANGUAGE_ZONE), 'title' => _x('Order by title', 'backend orderby', LANGUAGE_ZONE), 'date' => _x('Order by date', 'backend orderby', LANGUAGE_ZONE), 'modified' => _x('Order by modified', 'backend orderby', LANGUAGE_ZONE), 'rand' => _x('Order by rand', 'backend orderby', LANGUAGE_ZONE), 'menu_order' => _x('Order by menu', 'backend orderby', LANGUAGE_ZONE)); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', LANGUAGE_ZONE); ?> </label> <input id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo esc_attr($instance['title']); ?> " class="widefat" /> </p> <p> <strong><?php _e('Show Albums from following categories:', LANGUAGE_ZONE); ?> </strong><br /> <?php $terms = get_terms('dt_gallery_category', array('hide_empty' => 1, 'hierarchical' => false)); if (!is_wp_error($terms)) { ?> <div class="dt-widget-switcher"> <?php dt_core_mb_draw_radio_switcher($this->get_field_name('select'), $instance['select'], array('all' => array('desc' => __('All', LANGUAGE_ZONE)), 'only' => array('desc' => __('Only', LANGUAGE_ZONE)), 'except' => array('desc' => __('Except', LANGUAGE_ZONE)))); ?> </div> <div class="hide-if-js"> <?php foreach ($terms as $term) { ?> <input id="<?php echo $this->get_field_id($term->term_id); ?> " type="checkbox" name="<?php echo $this->get_field_name('cats'); ?> []" value="<?php echo $term->term_id; ?> " <?php checked(in_array($term->term_id, $instance['cats'])); ?> /> <label for="<?php echo $this->get_field_id($term->term_id); ?> "><?php echo $term->name; ?> </label><br /> <?php } ?> </div> <?php } else { ?> <span style="color: red;"><?php _e('There is no catehories', LANGUAGE_ZONE); ?> </span> <?php } ?> </p> <p> <label for="<?php echo $this->get_field_id('desc'); ?> "><?php _e('Show hoovering description:', LANGUAGE_ZONE); ?> </label> <input id="<?php echo $this->get_field_id('desc'); ?> " type="checkbox" name="<?php echo $this->get_field_name('desc'); ?> " <?php checked($instance['desc']); ?> /> </p> <p> <label for="<?php echo $this->get_field_id('orderby'); ?> "><?php _e('Show:', LANGUAGE_ZONE); ?> </label> <select id="<?php echo $this->get_field_id('orderby'); ?> " name="<?php echo $this->get_field_name('orderby'); ?> "> <?php foreach ($p_orderby as $value => $name) { ?> <option value="<?php echo $value; ?> " <?php selected($instance['orderby'], $value); ?> ><?php echo $name; ?> </option> <?php } ?> </select> </p> </p> <?php echo _e('Sort by:', LANGUAGE_ZONE); ?> <label> <input name="<?php echo $this->get_field_name('order'); ?> " value="ASC" type="radio" <?php checked($instance['order'], 'ASC'); ?> /><?php _e('Ascending', LANGUAGE_ZONE); ?> </label> <label> <input name="<?php echo $this->get_field_name('order'); ?> " value="DESC" type="radio" <?php checked($instance['order'], 'DESC'); ?> /><?php _e('Descending', LANGUAGE_ZONE); ?> </label> </p> <p> <label for="<?php echo $this->get_field_id('thumb_height'); ?> "><?php _e('Thumbnail Height:', LANGUAGE_ZONE); ?> </label> <input id="<?php echo $this->get_field_id('thumb_height'); ?> " name="<?php echo $this->get_field_name('thumb_height'); ?> " value="<?php echo esc_attr($instance['thumb_height']); ?> " size="3" maxlength="3" /> </p> <p> <label for="<?php echo $this->get_field_id('show'); ?> "><?php _e('How many:', LANGUAGE_ZONE); ?> </label> <input id="<?php echo $this->get_field_id('show'); ?> " name="<?php echo $this->get_field_name('show'); ?> " value="<?php echo esc_attr($instance['show']); ?> " size="2" maxlength="2" /> </p> <p> <label for="<?php echo $this->get_field_id('autoslide'); ?> "><?php _e('Autoslide:', LANGUAGE_ZONE); ?> </label> <input id="<?php echo $this->get_field_id('autoslide'); ?> " name="<?php echo $this->get_field_name('autoslide'); ?> " value="<?php echo esc_attr($instance['autoslide']); ?> " size="6" maxlength="6" /> <em>milliseconds<br /> (1 second = 1000 milliseconds; to disable autoslide leave this field blank or set it to "0")</em> </p> <div style="clear: both;"></div> <?php }
/** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ function form($instance) { /* Set up some default widget settings. */ $defaults = array('title' => '', 'order' => 'ASC', 'show' => 6, 'orderby' => 'date', 'select' => 'all', 'thumb' => true, 'cats' => array()); $instance = wp_parse_args((array) $instance, $defaults); $p_orderby = array('ID' => _x('Order by ID', 'backend orderby', LANGUAGE_ZONE), 'author' => _x('Order by author', 'backend orderby', LANGUAGE_ZONE), 'title' => _x('Order by title', 'backend orderby', LANGUAGE_ZONE), 'date' => _x('Order by date', 'backend orderby', LANGUAGE_ZONE), 'modified' => _x('Order by modified', 'backend orderby', LANGUAGE_ZONE), 'rand' => _x('Order by rand', 'backend orderby', LANGUAGE_ZONE), 'menu_order' => _x('Order by menu', 'backend orderby', LANGUAGE_ZONE)); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', LANGUAGE_ZONE); ?> </label> <input type="text" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo esc_attr($instance['title']); ?> " class="widefat" /> </p> <p> <strong><?php _e('Show Posts from following categories:', LANGUAGE_ZONE); ?> </strong><br /> <?php $terms = get_terms('category', array('hide_empty' => 1, 'hierarchical' => false)); if (!is_wp_error($terms)) { ?> <div class="dt-widget-switcher"> <?php dt_core_mb_draw_radio_switcher($this->get_field_name('select'), $instance['select'], array('all' => array('desc' => __('All', LANGUAGE_ZONE)), 'only' => array('desc' => __('Only', LANGUAGE_ZONE)), 'except' => array('desc' => __('Except', LANGUAGE_ZONE)))); ?> </div> <div class="hide-if-js"> <?php foreach ($terms as $term) { ?> <input id="<?php echo $this->get_field_id($term->term_id); ?> " type="checkbox" name="<?php echo $this->get_field_name('cats'); ?> []" value="<?php echo $term->term_id; ?> " <?php checked(in_array($term->term_id, $instance['cats'])); ?> /> <label for="<?php echo $this->get_field_id($term->term_id); ?> "><?php echo $term->name; ?> </label><br /> <?php } ?> </div> <?php } else { ?> <span style="color: red;"><?php _e('There is no categories', LANGUAGE_ZONE); ?> </span> <?php } ?> </p> <p> <label for="<?php echo $this->get_field_id('orderby'); ?> "><?php _e('Show:', LANGUAGE_ZONE); ?> </label> <select id="<?php echo $this->get_field_id('orderby'); ?> " name="<?php echo $this->get_field_name('orderby'); ?> "> <?php foreach ($p_orderby as $value => $name) { ?> <option value="<?php echo $value; ?> " <?php selected($instance['orderby'], $value); ?> ><?php echo $name; ?> </option> <?php } ?> </select> </p> </p> <?php echo _e('Sort by:', LANGUAGE_ZONE); ?> <label> <input name="<?php echo $this->get_field_name('order'); ?> " value="ASC" type="radio" <?php checked($instance['order'], 'ASC'); ?> /><?php _e('Ascending', LANGUAGE_ZONE); ?> </label> <label> <input name="<?php echo $this->get_field_name('order'); ?> " value="DESC" type="radio" <?php checked($instance['order'], 'DESC'); ?> /><?php _e('Descending', LANGUAGE_ZONE); ?> </label> </p> <p> <label for="<?php echo $this->get_field_id('show'); ?> "><?php _e('How many:', LANGUAGE_ZONE); ?> </label> <input id="<?php echo $this->get_field_id('show'); ?> " name="<?php echo $this->get_field_name('show'); ?> " value="<?php echo esc_attr($instance['show']); ?> " size="3" /> </p> <p> <input id="<?php echo $this->get_field_id('thumb'); ?> " type="checkbox" name="<?php echo $this->get_field_name('thumb'); ?> " <?php checked($instance['thumb']); ?> /> <label for="<?php echo $this->get_field_id('thumb'); ?> "><?php _e('Show featured images', LANGUAGE_ZONE); ?> </label> </p> <div style="clear: both;"></div> <?php }
function dt_core_mb_draw_modern_selector(array $opts = array()) { $defaults = array('taxonomy' => null, 'maintab_class' => 'dt_all_sliders', 'box_name' => null, 'albums_name' => '', 'cats_name' => '', 'posts' => array(), 'terms' => array(), 'albums' => array(), 'albums_cats' => array(), 'links' => array(), 'text' => array(), 'cur_type' => null, 'cur_select' => null); $opts = wp_parse_args($opts, $defaults); $tabs_arr = array('arrange' => __('Arrange by:', LANGUAGE_ZONE), 'only' => __('Only', LANGUAGE_ZONE), 'except' => __('All, except', LANGUAGE_ZONE), 'all' => __('All', LANGUAGE_ZONE)); $type = array('albums' => array('desc' => __('Albums', LANGUAGE_ZONE), 'class' => 'type_selector', 'wrap' => '<label class="dt_arrange dt_by-albums">%1$s<span>%2$s</span></label>'), 'category' => array('desc' => __('Category', LANGUAGE_ZONE), 'class' => 'type_selector', 'wrap' => '<label class="dt_arrange dt_by-categories">%1$s<span>%2$s</span></label>')); $select = array('all' => array('desc' => __('All', LANGUAGE_ZONE), 'wrap' => '<label class="dt_tab dt_all">%1$s<span>%2$s</span></label>'), 'only' => array('desc' => __('Only', LANGUAGE_ZONE), 'wrap' => '<label class="dt_tab dt_only">%1$s<span>%2$s</span></label>'), 'except' => array('desc' => __('All, except', LANGUAGE_ZONE), 'wrap' => '<label class="dt_tab dt_except">%1$s<span>%2$s</span></label>')); if ($opts['posts']) { $posts_arr = array(); foreach ($opts['posts'] as $pst) { $posts_arr[] = intval($pst->ID); } $posts_arr = implode(',', $posts_arr); global $wpdb; $atts = intval($wpdb->get_var("SELECT count(*) FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_mime_type LIKE 'image/%%' AND post_status != 'trash' AND post_parent IN({$posts_arr})")); } ?> <div class="dt_tabs"> <div class="dt_arrange-by"> <?php if ($opts['terms'] && $opts['posts']) { ?> <strong><?php echo $tabs_arr['arrange']; ?> </strong> <?php } elseif ($opts['terms']) { unset($type['albums']); $type['category']['wrap'] = '<label class="dt_arrange dt_by-categories">%1$s</label>'; } elseif ($opts['posts']) { unset($type['category']); $type['albums']['wrap'] = '<label class="dt_arrange dt_by-albums">%1$s</label>'; } ?> <?php dt_core_mb_draw_radio_switcher($opts['box_name'] . '_type', $opts['cur_type'], $type); ?> </div> <?php dt_core_mb_draw_radio_switcher($opts['box_name'] . '_select', $opts['cur_select'], $select); ?> </div> <div class="dt_tabs-content"> <div class="dt_tab-all hide-if-js"> <div class="dt_all_desc<?php echo !empty($opts['maintab_class']) ? ' ' . esc_attr($opts['maintab_class']) : ''; ?> "> <?php if (!empty($opts['text']) && is_array($opts['text'])) { ?> <?php echo $opts['text']['header']; ?> <ul> <li> <strong><?php echo $select['all']['desc']; ?> </strong> <?php echo isset($opts['text']['select_desc'][0]) ? $opts['text']['select_desc'][0] : ''; ?> </li> <li> <strong><?php echo $select['only']['desc']; ?> </strong> <?php echo isset($opts['text']['select_desc'][1]) ? $opts['text']['select_desc'][1] : ''; ?> </li> <li> <strong><?php echo $select['except']['desc']; ?> </strong> <?php echo isset($opts['text']['select_desc'][2]) ? $opts['text']['select_desc'][2] : ''; ?> </li> </ul> <?php if (isset($opts['text']['info_desc'])) { ?> <p class="dt_hr"></p> <h4><?php echo _x('You have:', 'backend', LANGUAGE_ZONE); ?> </h4> <ul class="dt_total"> <?php if ($opts['posts']) { ?> <li class="dt_total_albums"><?php printf($opts['text']['info_desc'][0], count($opts['posts'])); ?> </li> <?php if (isset($opts['text']['info_desc'][1])) { ?> <li class="dt_total_images"><?php printf($opts['text']['info_desc'][1], $atts); ?> </li> <?php } ?> <?php } ?> <?php if ($opts['terms']) { ?> <li class="dt_total_categories"><?php printf(_x('%d categories', 'backend', LANGUAGE_ZONE), count($opts['terms'])); ?> </li> <?php } ?> </ul> <?php } ?> <?php } ?> <?php dt_core_mb_draw_functional_links($opts['links']); ?> </div> </div> <div class="dt_tab-select hide-if-js"> <?php if ($opts['posts'] && $opts['albums_name']) { ?> <div class="dt_tab-items hide-if-js"><?php $args = array(); if ($opts['taxonomy']) { $args['taxonomy'] = $opts['taxonomy']; } dt_core_mb_draw_posts_list($opts['albums_name'], $opts['albums'], $opts['posts'], $args); ?> </div> <?php } ?> <?php if ($opts['terms'] && $opts['cats_name']) { ?> <div class="dt_tab-categories hide-if-js"><?php dt_core_mb_draw_category_list($opts['cats_name'], $opts['albums_cats'], $opts['terms']); ?> </div> <?php } ?> <div class="dt_nano-mask" style="display: none; "></div> </div> </div><!-- .tabs_content --> <?php }
/** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ function form($instance) { /* Set up some default widget settings. */ $instance = wp_parse_args((array) $instance, self::$default_instance); // for compatibility $instance['order'] = $this->dt_sanitize_enum($instance['order'], self::$order_reference); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', LANGUAGE_ZONE); ?> </label> <input id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo esc_attr($instance['title']); ?> " class="widefat" /> </p> <p> <strong><?php _e('Show photos from albums in following categories:', LANGUAGE_ZONE); ?> </strong><br /> <?php $terms = get_terms('dt_gallery_category', array('hide_empty' => 1, 'hierarchical' => false)); if (!is_wp_error($terms)) { ?> <div class="dt-widget-switcher"> <?php dt_core_mb_draw_radio_switcher($this->get_field_name('select'), $instance['select'], array('all' => array('desc' => __('All', LANGUAGE_ZONE)), 'only' => array('desc' => __('Only', LANGUAGE_ZONE)), 'except' => array('desc' => __('Except', LANGUAGE_ZONE)))); ?> </div> <div class="hide-if-js"> <?php foreach ($terms as $term) { ?> <input id="<?php echo $this->get_field_id($term->term_id); ?> " type="checkbox" name="<?php echo $this->get_field_name('cats'); ?> []" value="<?php echo $term->term_id; ?> " <?php checked(in_array($term->term_id, $instance['cats'])); ?> /> <label for="<?php echo $this->get_field_id($term->term_id); ?> "><?php echo $term->name; ?> </label><br /> <?php } ?> </div> <?php } else { ?> <span style="color: red;"><?php echo $terms->get_error_message(); ?> </span> <?php } ?> </p> <p> <label for="<?php echo $this->get_field_id('orderby'); ?> "><?php _e('Show:', LANGUAGE_ZONE); ?> </label> <select id="<?php echo $this->get_field_id('orderby'); ?> " name="<?php echo $this->get_field_name('orderby'); ?> "> <?php foreach (self::$orderby_reference as $value => $name) { ?> <option value="<?php echo $value; ?> " <?php selected($instance['orderby'], $value); ?> ><?php echo $name; ?> </option> <?php } ?> </select> </p> </p> <?php _e('Sort by:', LANGUAGE_ZONE); ?> <label> <input name="<?php echo $this->get_field_name('order'); ?> " value="ASC" type="radio" <?php checked($instance['order'], 'ASC'); ?> /><?php _e('Ascending', LANGUAGE_ZONE); ?> </label> <label> <input name="<?php echo $this->get_field_name('order'); ?> " value="DESC" type="radio" <?php checked($instance['order'], 'DESC'); ?> /><?php _e('Descending', LANGUAGE_ZONE); ?> </label> </p> <p> <label for="<?php echo $this->get_field_id('show'); ?> "><?php _e('How many:', LANGUAGE_ZONE); ?> </label> <input id="<?php echo $this->get_field_id('show'); ?> " name="<?php echo $this->get_field_name('show'); ?> " value="<?php echo esc_attr($instance['show']); ?> " size="3" /> </p> <div style="clear: both;"></div> <?php }
function dt_metabox_catalog_layout_options($post) { $box_name = 'dt_catalog_layout_options'; $defaults = array('thumb_height' => '', 'ppp' => '', 'orderby' => 'date', 'order' => 'DESC', 'show_excerpt' => 'on', 'show_all_pages' => 'off', 'show_cat_filter' => 'on'); $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'); $radio_on_off = array('on' => array('desc' => _x('on', 'backend catalog layout', LANGUAGE_ZONE)), 'off' => array('desc' => _x('off', 'backend catalog layout', LANGUAGE_ZONE))); echo '<p><strong>' . _x('Thumbnail height', 'backend catalog layout', LANGUAGE_ZONE) . '</strong></p>'; echo dt_melement('text', array('name' => $box_name . '_thumb_height', 'description' => _x('(in pixels). If not specified, default value will be taken.', 'backend catalog layout', LANGUAGE_ZONE), 'value' => $opts['thumb_height'], 'wrap' => '<p>%1$s <em>%2$s</em></p>')); echo '<div class="dt_hr"></div>'; echo '<p><strong>' . _x('Number of catalog items to display on one page', 'backend catalog layout', LANGUAGE_ZONE) . '</strong></p>'; echo '<p>'; echo dt_melement('text', array('name' => $box_name . '_ppp', 'value' => $opts['ppp'], 'wrap' => '%1$s')); echo '</p>'; echo '<div class="dt_hr"></div>'; echo '<p><strong>' . _x('Ordering settings', 'backend catalog layout', LANGUAGE_ZONE) . '</strong></p>'; dt_core_mb_draw_order_options(array('box_name' => $box_name, 'order_current' => $opts['order'], 'orderby_current' => $opts['orderby'])); printf('<div class="hide-if-no-js"><div class="dt_hr"></div><p><a href="#advanced-options" class="dt_advanced"> <input type="hidden" name="%1$s" data-name="%1$s" value="hide" /> <span class="dt_advanced-show">%2$s</span> <span class="dt_advanced-hide">%3$s</span> %4$s </a></p></div>', 'dt_catalog-advanced', _x('+ Show', 'backend catalog layout', LANGUAGE_ZONE), _x('- Hide', 'backend catalog layout', LANGUAGE_ZONE), _x('advanced settings', 'backend catalog layout', LANGUAGE_ZONE)); echo '<div class="dt_catalog-advanced dt_container hide-if-js"><div class="dt_hr"></div>'; echo '<p class="dt_switcher-box"><strong>' . _x('Show all pages in paginator', 'backend catalog layout', LANGUAGE_ZONE) . '</strong>'; dt_core_mb_draw_radio_switcher($box_name . '_show_all_pages', $opts['show_all_pages'], $radio_on_off); echo '</p>'; echo '<div class="dt_hr"></div>'; echo '<p class="dt_switcher-box"><strong>' . _x('Show categories filter', 'backend catalog layout', LANGUAGE_ZONE) . '</strong>'; dt_core_mb_draw_radio_switcher($box_name . '_show_cat_filter', $opts['show_cat_filter'], $radio_on_off); echo '</p>'; echo '</div>'; }
function dt_metabox_testimonials_options($post) { $box_name = 'dt_meta_testimonials_options'; $defaults = array('content_position' => 'top', 'orderby' => 'date', 'order' => 'DESC', 'ppp' => ''); $opts = get_post_meta($post->ID, '_' . $box_name, true); $opts = wp_parse_args(maybe_unserialize($opts), $defaults); $radio_top_bottom = array('top' => array('desc' => _x('Top', 'backend testimonials layout', LANGUAGE_ZONE)), 'bottom' => array('desc' => _x('Bottom', 'backend testimonials layout', LANGUAGE_ZONE))); $ppp = dt_melement('text', array('name' => $box_name . '_ppp', 'value' => $opts['ppp'], 'wrap' => '%1$s')); // Use nonce for verification wp_nonce_field(plugin_basename(__FILE__), $box_name . '_nonce'); echo '<p class="dt_switcher-box"><strong>' . _x('Content position', 'backend testimonials', LANGUAGE_ZONE) . '</strong>'; dt_core_mb_draw_radio_switcher($box_name . '_content_position', $opts['content_position'], $radio_top_bottom); echo '</p>'; echo '<p><strong>' . _x('Number of posts to display on one page', 'backend testimonials', LANGUAGE_ZONE) . '</strong></p>'; echo '<p>' . $ppp . '</p>'; echo '<div class="dt_hr"></div>'; echo '<p><strong>' . _x('Ordering settings', 'backend blog', LANGUAGE_ZONE) . '</strong></p>'; dt_core_mb_draw_order_options(array('box_name' => $box_name, 'order_current' => $opts['order'], 'orderby_current' => $opts['orderby'])); }