function vce_category_edit_meta_fields($term) { $vce_meta = vce_get_category_meta($term->term_id); $sidebars_lay = vce_get_sidebar_layouts(true); $sidebars = vce_get_sidebars_list(true); $post_layouts = vce_get_main_layouts(true); $starter_layouts = vce_get_main_layouts(true, true); $fa_layouts = vce_get_featured_area_layouts(true, true); ?> <tr class="form-field"> <th scope="row" valign="top"> <label><?php _e('Featured area layout', THEME_SLUG); ?> </label> </th> <td> <ul class="vce-img-select-wrap next-hide"> <?php foreach ($fa_layouts as $id => $layout) { ?> <li> <?php $selected_class = vce_compare($vce_meta['fa_layout'], $id) ? ' selected' : ''; ?> <img src="<?php echo $layout['img']; ?> " title="<?php echo $layout['title']; ?> " class="vce-img-select<?php echo $selected_class; ?> "> <input type="radio" class="vce-hidden" name="vce[fa_layout]" value="<?php echo $id; ?> " <?php checked($id, $vce_meta['fa_layout']); ?> /> </label> </li> <?php } ?> </ul> <p class="description"><?php _e('Choose featured area layout', THEME_SLUG); ?> </p> </td> </tr> <?php $style = $vce_meta['fa_layout'] == 'inherit' || !$vce_meta['fa_layout'] ? 'style="display:none"' : ''; ?> <tr class="form-field" <?php echo $style; ?> > <th scope="row" valign="top"> <label><?php _e('Featured area posts limit', THEME_SLUG); ?> </label> </th> <td> <input type="text" name="vce[fa_limit]" value="<?php echo $vce_meta['fa_limit']; ?> " style="width: 30px;"/> <?php _e('post(s)', THEME_SLUG); ?> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label><?php _e('Posts main layout', THEME_SLUG); ?> </label> </th> <td> <ul class="vce-img-select-wrap next-hide"> <?php foreach ($post_layouts as $id => $layout) { ?> <li> <?php $selected_class = vce_compare($vce_meta['layout'], $id) ? ' selected' : ''; ?> <img src="<?php echo $layout['img']; ?> " title="<?php echo $layout['title']; ?> " class="vce-img-select<?php echo $selected_class; ?> "> <input type="radio" class="vce-hidden" name="vce[layout]" value="<?php echo $id; ?> " <?php checked($id, $vce_meta['layout']); ?> /> </label> </li> <?php } ?> </ul> <p class="description"><?php _e('Choose posts layout for this category', THEME_SLUG); ?> </p> </td> </tr> <?php $style = $vce_meta['layout'] == 'inherit' ? 'style="display:none"' : ''; ?> <tr class="form-field" <?php echo $style; ?> > <th scope="row" valign="top"> <label><?php _e('Number of posts per page', THEME_SLUG); ?> </label> </th> <td> <input type="text" name="vce[ppp]" value="<?php echo $vce_meta['ppp']; ?> " style="width: 30px;"/> <?php _e('post(s)', THEME_SLUG); ?> <br/> <small class="description"><?php _e('Note: leave empty if you want to inherit from global category option', THEME_SLUG); ?> </small> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label><?php _e('Starter posts layout', THEME_SLUG); ?> </label> </th> <td> <ul class="vce-img-select-wrap next-hide"> <?php foreach ($starter_layouts as $id => $layout) { ?> <li> <?php $selected_class = vce_compare($vce_meta['top_layout'], $id) ? ' selected' : ''; ?> <img src="<?php echo $layout['img']; ?> " title="<?php echo $layout['title']; ?> " class="vce-img-select<?php echo $selected_class; ?> "> <input type="radio" class="vce-hidden" name="vce[top_layout]" value="<?php echo $id; ?> " <?php checked($id, $vce_meta['top_layout']); ?> /> </label> </li> <?php } ?> </ul> <p class="description"><?php _e('Check if you want to use starter posts', THEME_SLUG); ?> </p> </td> </tr> <?php $style = $vce_meta['top_layout'] == 'inherit' || !$vce_meta['top_layout'] ? 'style="display:none"' : ''; ?> <tr class="form-field" <?php echo $style; ?> > <th scope="row" valign="top"> <label><?php _e('Starter posts limit', THEME_SLUG); ?> </label> </th> <td> <input type="text" name="vce[top_limit]" value="<?php echo $vce_meta['top_limit']; ?> " style="width: 30px;"/> <?php _e('post(s)', THEME_SLUG); ?> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label><?php _e('Sidebar layout', THEME_SLUG); ?> </label> </th> <td> <ul class="vce-img-select-wrap"> <?php foreach ($sidebars_lay as $id => $layout) { ?> <li> <?php $selected_class = vce_compare($vce_meta['use_sidebar'], $id) ? ' selected' : ''; ?> <img src="<?php echo $layout['img']; ?> " title="<?php echo $layout['title']; ?> " class="vce-img-select<?php echo $selected_class; ?> "> <input type="radio" class="vce-hidden" name="vce[use_sidebar]" value="<?php echo $id; ?> " <?php checked($id, $vce_meta['use_sidebar']); ?> /> </label> </li> <?php } ?> </ul> <p class="description"><?php _e('Choose sidebar layout', THEME_SLUG); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label><?php _e('Standard sidebar', THEME_SLUG); ?> </label> </th> <td> <select name="vce[sidebar]" class="widefat"> <?php foreach ($sidebars as $id => $name) { ?> <option value="<?php echo $id; ?> " <?php selected($id, $vce_meta['sidebar']); ?> ><?php echo $name; ?> </option> <?php } ?> </select> <p class="description"><?php _e('Choose standard sidebar to display', THEME_SLUG); ?> </p> </td> </tr> <tr class="form-field"> <th scope="row" valign="top"> <label><?php _e('Sticky sidebar', THEME_SLUG); ?> </label> </th> <td> <select name="vce[sticky_sidebar]" class="widefat"> <?php foreach ($sidebars as $id => $name) { ?> <option value="<?php echo $id; ?> " <?php selected($id, $vce_meta['sticky_sidebar']); ?> ><?php echo $name; ?> </option> <?php } ?> </select> <p class="description"><?php _e('Choose sticky sidebar to display', THEME_SLUG); ?> </p> </td> </tr> <?php $most_used = get_option('vce_recent_cat_colors'); $colors = ''; if (!empty($most_used)) { $colors .= '<p>' . __('Recently used', THEME_SLUG) . ': <br/>'; foreach ($most_used as $color) { $colors .= '<a href="#" style="width: 20px; height: 20px; background: ' . $color . '; float: left; margin-right:3px; border: 1px solid #aaa;" class="vce_colorpick" data-color="' . $color . '"></a>'; } $colors .= '</p>'; } ?> <tr class="form-field"> <th scope="row" valign="top"><label><?php _e('Color', THEME_SLUG); ?> </label></th> <td> <label><input type="radio" name="vce[color_type]" value="inherit" class="vce-radio color-type" <?php checked($vce_meta['color_type'], 'inherit'); ?> > <?php _e('Inherit from default accent color', THEME_SLUG); ?> </label> <br/> <label><input type="radio" name="vce[color_type]" value="custom" class="vce-radio color-type" <?php checked($vce_meta['color_type'], 'custom'); ?> > <?php _e('Custom', THEME_SLUG); ?> </label> <div id="vce_color_wrap"> <p> <input name="vce[color]" type="text" class="vce_colorpicker" value="<?php echo $vce_meta['color']; ?> " data-default-color="<?php echo $vce_meta['color']; ?> "/> </p> <?php if (!empty($colors)) { echo $colors; } ?> </div> <div class="clear"></div> <p class="howto"><?php _e('Choose color', THEME_SLUG); ?> </p> </td> </tr> <?php }
function vce_generate_module_field($module, $i = false, $data) { extract($data); $mod_id = $i === false ? 'vce-hidden-module' : 'vce-hidden-module-' . $i; $name_prefix = $i === false ? '' : 'vce[modules][' . $i . ']'; $edit = $i === false ? '' : 'edit'; ?> <div id="<?php echo $mod_id; ?> " class="vce-hidden-module"> <div class="vce-module-form <?php echo $edit; ?> "> <ul class="vce-tabs-nav"> <li class="active"><a href="#"><?php _e('Appearance', THEME_SLUG); ?> </a></li> <li><a href="#"><?php _e('Combine layouts', THEME_SLUG); ?> </a></li> <li><a href="#"><?php _e('Post selection', THEME_SLUG); ?> </a></li> <li><a href="#"><?php _e('Action', THEME_SLUG); ?> </a></li> <li class="save"><a class="vce-save-module button-primary" href="javascript:void(0);"><?php _e('Save Module', THEME_SLUG); ?> </a></li> </ul> <div class="vce-tabs-wrap"> <div class="vce-tab"> <p> <strong><?php _e('Title', THEME_SLUG); ?> :</strong><br/> <input class="vce-count-me" type="text" name="<?php echo $name_prefix; ?> [title]" value="<?php echo $module['title']; ?> "/><br/> <small class="howto"><?php _e('Enter your module title', THEME_SLUG); ?> </small> </p> <p> <strong><?php _e('Title link', THEME_SLUG); ?> :</strong><br/> <input class="vce-count-me" type="text" name="<?php echo $name_prefix; ?> [title_link]" value="<?php echo esc_attr($module['title_link']); ?> "/><br/> <small class="howto"><?php _e('Optionally, you can assign URL to title', THEME_SLUG); ?> </small> </p> <p><strong><?php _e('Choose layout', THEME_SLUG); ?> :</strong></p> <ul class="vce-img-select-wrap"> <?php foreach ($layouts as $id => $layout) { ?> <li> <?php $selected_class = vce_compare($id, $module['layout']) ? ' selected' : ''; ?> <img src="<?php echo $layout['img']; ?> " title="<?php echo $layout['title']; ?> " class="vce-img-select<?php echo $selected_class; ?> "> <br/><span><?php echo $layout['title']; ?> </span> <input type="radio" class="vce-hidden vce-count-me" name="<?php echo $name_prefix; ?> [layout]" value="<?php echo $id; ?> " <?php checked($id, $module['layout']); ?> /> </label> </li> <?php } ?> </ul> <small class="howto"><?php _e('Choose your main posts layout', THEME_SLUG); ?> </small> <p> <strong><?php _e('Max number of posts', THEME_SLUG); ?> :</strong><br/> <input class="vce-count-me" type="text" name="<?php echo $name_prefix; ?> [limit]" value="<?php echo $module['limit']; ?> "/><br/> <small class="howto"><?php _e('Specify maximum number of posts for this module', THEME_SLUG); ?> </small> </p> <p> <label><input type="checkbox" name="<?php echo $name_prefix; ?> [one_column]" value="1" class="vce-count-me" <?php checked($module['one_column'], 1); ?> /><strong><?php _e('Make this module one-column (half width)', THEME_SLUG); ?> </strong></label><br/> <small class="howto"><?php _e('This option may apply to layouts C, D and F which are naturally listed in two columns', THEME_SLUG); ?> </small> </p> </div> <div class="vce-tab"> <p><strong><?php _e('Choose starter posts layout', THEME_SLUG); ?> :</strong></p> <ul class="vce-img-select-wrap next-hide"> <?php foreach ($starter_layouts as $id => $layout) { ?> <li> <?php $selected_class = vce_compare($module['top_layout'], $id) ? ' selected' : ''; ?> <img src="<?php echo $layout['img']; ?> " title="<?php echo $layout['title']; ?> " class="vce-img-select<?php echo $selected_class; ?> "> <br/><span><?php echo $layout['title']; ?> </span> <input type="radio" class="vce-hidden vce-count-me" name="<?php echo $name_prefix; ?> [top_layout]" value="<?php echo $id; ?> " <?php checked($id, $module['top_layout']); ?> /> </label> </li> <?php } ?> </ul> <?php $style = !$module['top_layout'] ? 'style="display:none"' : ''; ?> <p class="form-field" <?php echo $style; ?> ><strong><?php _e('Number of starter posts', THEME_SLUG); ?> :</strong> <input type="text" name="<?php echo $name_prefix; ?> [top_limit]" value="<?php echo $module['top_limit']; ?> " class="vce-count-me" style="width: 30px;"/> </p> <p class="howto"><?php _e('Choose additional layout if you want to combine two layouts in same module so the first posts will be displayed in different layout', THEME_SLUG); ?> </p> </div> <div class="vce-tab"> <?php if (!empty($cats)) { ?> <div class="vce-opt-item"> <strong><?php _e('Filter by category', THEME_SLUG); ?> :</strong><br/> <div class="vce-item-scroll"> <?php foreach ($cats as $cat) { ?> <?php $checked = in_array($cat->term_id, $module['cat']) ? 'checked="checked"' : ''; ?> <label><input class="vce-count-me" type="checkbox" name="<?php echo $name_prefix; ?> [cat][]" value="<?php echo $cat->term_id; ?> " <?php echo $checked; ?> /><?php echo $cat->name; ?> </label><br/> <?php } ?> </div> <small class="howto"><?php _e('Check whether you want to display posts from specific categories only. Or leave empty for all categories.', THEME_SLUG); ?> </small><br/> <label><input type="checkbox" name="<?php echo $name_prefix; ?> [cat_child]" value="1" class="vce-count-me" <?php checked($module['cat_child'], 1); ?> /><strong><?php _e('Apply child categories', THEME_SLUG); ?> </strong></label><br/> <small class="howto"><?php _e('If parent category is selected, posts from child categories will be included automatically', THEME_SLUG); ?> </small> <br/> <strong><?php _e('Filter by tag', THEME_SLUG); ?> :</strong><br/> <div class="tagsdiv" id="post_tag"> <div class="jaxtag"> <label class="screen-reader-text" for="newtag"><?php _e('Tags'); ?> </label> <input type="hidden" name="<?php echo $name_prefix; ?> [tag]" class="the-tags vce-count-me" id="tax-input[post_tag]" value="<?php echo $module['tag']; ?> " /> <div class="ajaxtag"> <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?> " /> </div> </div> <div class="tagchecklist"> <?php $meta_tags = explode(',', $module['tag']); if (!empty($meta_tags)) { $tag_i = 0; foreach ($meta_tags as $tag_name) { ?> <span><a id="post_tag-check-num-<?php echo $i; ?> " class="ntdelbutton">X</a> <?php echo $tag_name; ?> </span> <?php $tag_i++; } } ?> </div> </div> </div> <?php } ?> <div class="vce-opt-item"> <div style="width:50%; float:left;"> <strong><?php _e('Not older than', THEME_SLUG); ?> :</strong><br/> <?php foreach ($time['from'] as $id => $title) { ?> <label><input type="radio" name="<?php echo $name_prefix; ?> [time]" value="<?php echo $id; ?> " <?php checked($module['time'], $id); ?> class="vce-count-me" /><?php echo $title; ?> </label><br/> <?php } ?> <small class="howto"><?php _e('Display posts that are not older than some specific time', THEME_SLUG); ?> </small> <br/> </div> <div style="width:50%; float:left;"> <strong><?php _e('Older than', THEME_SLUG); ?> :</strong><br/> <?php foreach ($time['to'] as $id => $title) { ?> <label><input type="radio" name="<?php echo $name_prefix; ?> [timeto]" value="<?php echo $id; ?> " <?php checked($module['timeto'], $id); ?> class="vce-count-me" /><?php echo $title; ?> </label><br/> <?php } ?> <small class="howto"><?php _e('Display posts that are older than some specific time', THEME_SLUG); ?> </small> <br/> </div> <strong><?php _e('Order posts by', THEME_SLUG); ?> :</strong><br/> <?php foreach ($order as $id => $title) { ?> <label><input type="radio" name="<?php echo $name_prefix; ?> [order]" value="<?php echo $id; ?> " <?php checked($module['order'], $id); ?> class="vce-count-me" /><?php echo $title; ?> </label><br/> <?php } ?> <small class="howto"><?php _e('Specify posts ordering', THEME_SLUG); ?> </small> <br/> <strong><?php _e('Choose posts (or pages) manually', THEME_SLUG); ?> :</strong><br/> <?php $manual = !empty($module['manual']) ? implode(",", $module['manual']) : ''; ?> <input type="text" name="<?php echo $name_prefix; ?> [manual]" value="<?php echo $manual; ?> " class="vce-count-me" style="width: 100%;"/><br/> <small class="howto"><?php _e('Specify post ids separated by comma if you want to select only those posts. i.e. 213,32,12,45', THEME_SLUG); ?> </small> </div> <div class="clear"></div> <p><label><input type="checkbox" class="vce-count-me" name="<?php echo $name_prefix; ?> [exclude]" value="1" <?php checked($module['exclude'], 1); ?> /><strong><?php _e('Do not duplicate (display only in this module)', THEME_SLUG); ?> </strong></label> <br/> <small class="howto"><?php _e('Check this option if you want posts in this module to be excluded from other modules so they don\'t appear twice', THEME_SLUG); ?> </small></p> </div> <div class="vce-tab"> <p><strong><?php _e('Choose additional options', THEME_SLUG); ?> :</strong><br/> <?php foreach ($actions as $id => $title) { ?> <label><input type="radio" name="<?php echo $name_prefix; ?> [action]" value="<?php echo $id; ?> " <?php checked($module['action'], $id); ?> class="vce-count-me vce-action-pick" /><?php echo $title; ?> </label><br/> <?php } ?> </p> <?php $style = vce_compare($module['action'], 'pagination') ? '' : 'style="display:none"'; ?> <div class="vce-pagination-wrap hideable" <?php echo $style; ?> > <p><strong><?php _e('Choose pagination type', THEME_SLUG); ?> :</strong></p> <ul class="vce-img-select-wrap"> <?php foreach ($paginations as $id => $pagination) { ?> <li> <?php $selected_class = vce_compare($module['pagination'], $id) ? ' selected' : ''; ?> <img src="<?php echo $pagination['img']; ?> " title="<?php echo $pagination['title']; ?> " class="vce-img-select<?php echo $selected_class; ?> "> <br/><span><?php echo $pagination['title']; ?> </span> <input type="radio" class="vce-hidden vce-count-me" name="<?php echo $name_prefix; ?> [pagination]" value="<?php echo $id; ?> " <?php checked($id, $module['pagination']); ?> /> </label> </li> <?php } ?> </ul> <small class="howto"><?php _e('Note: Pagination can be added only for the last module on the page', THEME_SLUG); ?> </small> </div> <?php $style = vce_compare($module['action'], 'link') ? '' : 'style="display:none"'; ?> <div class="vce-link-wrap hideable" <?php echo $style; ?> > <p><strong><?php _e('Link/Button Text', THEME_SLUG); ?> :</strong><br/> <input type="text" name="<?php echo $name_prefix; ?> [action_link_text]" value="<?php echo esc_attr($module['action_link_text']); ?> " class="vce-count-me"/></p> <p><strong><?php _e('Link/Button URL', THEME_SLUG); ?> :</strong><br/> <input type="text" name="<?php echo $name_prefix; ?> [action_link_url]" value="<?php echo esc_url($module['action_link_url']); ?> " class="vce-count-me"/></p> </div> <?php $style = vce_compare($module['action'], 'slider') ? '' : 'style="display:none"'; ?> <div class="vce-slider-wrap hideable" <?php echo $style; ?> > <p><strong><?php _e('Autoplay slider posts', THEME_SLUG); ?> :</strong><br/> <input type="text" name="<?php echo $name_prefix; ?> [autoplay]" value="<?php echo esc_attr($module['autoplay']); ?> " class="vce-count-me"/> <br/> <small class="howto"><?php _e('Specify number of seconds if you want to auto-slide posts, or leave empty for no autoplay', THEME_SLUG); ?> </small> </p> </div> </div> </div> <input class="vce-count-me" type="hidden" name="<?php echo $name_prefix; ?> [type]" value="posts"/> </div> </div> <?php }