Exemple #1
0
 public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $control_buffy = '';
     //read the menu setting from post meta (menu id, key, single)
     $td_mega_menu_cat = get_post_meta($item->ID, 'td_mega_menu_cat', true);
     $td_mega_menu_page_id = get_post_meta($item->ID, 'td_mega_menu_page_id', true);
     //make the tree
     $td_category_tree = array_merge(array(' - Not mega menu - ' => ''), td_util::get_category2id_array(false));
     //make a new ui control ( dropdown )
     $control_buffy .= '<p class="description description-wide"><br><br>';
     $control_buffy .= '<label>';
     $control_buffy .= 'Make this a category mega menu';
     $control_buffy .= '</label>';
     $control_buffy .= '<select name="td_mega_menu_cat[' . $item->ID . ']" id="" class="widefat code edit-menu-item-url">';
     foreach ($td_category_tree as $category => $category_id) {
         $control_buffy .= '<option value="' . $category_id . '"' . selected($td_mega_menu_cat, $category_id, false) . '>' . $category . '</option>';
     }
     $control_buffy .= ' </select>';
     $control_buffy .= '</p>';
     $control_buffy .= '<br>OR<br>';
     //make a new ui control ( dropdown )
     $control_buffy .= '<p class="description description-wide">';
     $control_buffy .= '<label>';
     $control_buffy .= 'Load a page in the menu (enter the page ID)';
     $control_buffy .= '</label><br>';
     $control_buffy .= '<input name="td_mega_menu_page_id[' . $item->ID . ']" type="text" value="' . $td_mega_menu_page_id . '" />';
     $control_buffy .= '<span class="td-wpa-info"><strong>Just a tip:</strong> If you choose to load a mega menu or a page, please do not add submenus to this item. The mega menu and mega page menu have to be the top most menu item. <a href="http://forum.tagdiv.com/menus-newsmag/" target="_blank">Read more</a></span>';
     $control_buffy .= '</p>';
     //run the parent and add in $buffy (byref) our code via regex
     $buffy = '';
     parent::start_el($buffy, $item, $depth, $args, $id);
     $buffy = preg_replace('/(?=<div.*submitbox)/', $control_buffy, $buffy);
     $output .= $buffy;
 }
 public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $control_buffy = '';
     //read the menu setting from post meta (menu id, key, single)
     $td_mega_menu_cat = get_post_meta($item->ID, 'td_mega_menu_cat', true);
     $td_mega_menu_page_id = get_post_meta($item->ID, 'td_mega_menu_page_id', true);
     //make the tree
     $td_category_tree = array_merge(array(' - 不是大菜单 - ' => ''), td_util::get_category2id_array(false));
     //make a new ui control ( dropdown )
     $control_buffy .= '<p class="description description-wide"><br><br>';
     $control_buffy .= '<label>';
     $control_buffy .= '使这个分类为大菜单';
     $control_buffy .= '</label>';
     $control_buffy .= '<select name="td_mega_menu_cat[' . $item->ID . ']" id="" class="widefat code edit-menu-item-url">';
     foreach ($td_category_tree as $category => $category_id) {
         $control_buffy .= '<option value="' . $category_id . '"' . selected($td_mega_menu_cat, $category_id, false) . '>' . $category . '</option>';
     }
     $control_buffy .= ' </select>';
     $control_buffy .= '</p>';
     $control_buffy .= '<br>或<br>';
     //make a new ui control ( dropdown )
     $control_buffy .= '<p class="description description-wide">';
     $control_buffy .= '<label>';
     $control_buffy .= '在菜单加载页面(输入页面ID)';
     $control_buffy .= '</label><br>';
     $control_buffy .= '<input name="td_mega_menu_page_id[' . $item->ID . ']" type="text" value="' . $td_mega_menu_page_id . '" />';
     $control_buffy .= '<span class="td-wpa-info"><strong>提示:</strong>如果你选择加载一个大菜单或页面,请不要给此项目添加子菜单。大菜单和大页面菜单是顶级菜单项目。<a href="http://forum.tagdiv.com/menus-newsmag/" target="_blank">阅读更多</a></span>';
     $control_buffy .= '</p>';
     //run the parent and add in $buffy (byref) our code via regex
     $buffy = '';
     parent::start_el($buffy, $item, $depth, $args, $id);
     $buffy = preg_replace('/(?=<div.*submitbox)/', $control_buffy, $buffy);
     $output .= $buffy;
 }
Exemple #3
0
 public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $buffy = '';
     $control_buffy = '';
     //read the menu setting
     $td_mega_menu_cat = get_post_meta($item->ID, 'td_mega_menu_cat', true);
     //make the tree
     $td_category_tree = array_merge(array(' - Not mega menu - ' => ''), td_util::get_category2id_array(false));
     $control_buffy .= '<p class="description description-wide">';
     $control_buffy .= '<label>';
     $control_buffy .= 'Make this a category mega menu';
     $control_buffy .= '</label>';
     $control_buffy .= '<select name="td_mega_menu_cat[' . $item->ID . ']" id="" class="widefat code edit-menu-item-url">';
     foreach ($td_category_tree as $category => $category_id) {
         $control_buffy .= '<option value="' . $category_id . '"' . selected($td_mega_menu_cat, $category_id, false) . '>' . $category . '</option>';
     }
     $control_buffy .= ' </select>';
     $control_buffy .= '</p>';
     parent::start_el($buffy, $item, $depth, $args, $id);
     $buffy = preg_replace('/(?=<div.*submitbox)/', $control_buffy, $buffy);
     $output .= $buffy;
 }
 static function get_array()
 {
     return array(array("param_name" => "category_id", "type" => "dropdown", "value" => td_util::get_category2id_array(), "heading" => __("Category filter:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "category_ids", "type" => "textfield", "value" => '', "heading" => __("Multiple categories filter:", TD_THEME_NAME), "description" => "To filter multiple categories, enter here the category IDs separated by commas (example: 13,23,18)", "holder" => "div", "class" => ""), array("param_name" => "tag_slug", "type" => "textfield", "value" => '', "heading" => __("Filter by tag slug:", TD_THEME_NAME), "description" => "To filter multiple tag slug, enter here the tag slugs separated by commas (example: tag1,tag2,tag3)", "holder" => "div", "class" => ""), array("param_name" => "sort", "type" => "dropdown", "value" => array('- Latest -' => '', 'Random posts Today' => 'random_today', 'Random posts from last 7 Day' => 'random_7_day', 'Alphabetical A -> Z' => 'alphabetical_order', 'Popular (all time)' => 'popular', 'Popular (last 7 days; enable first from ' . TD_THEME_NAME . ' Panel -> Post Settings -> Use 7 days post sorting)' => 'popular7', 'Featured' => 'featured', 'Highest rated (reviews)' => 'review_high', 'Random Posts' => 'random_posts', 'Most Commented' => 'comment_count'), "heading" => __("Sort order:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "autors_id", "type" => "dropdown", "value" => td_util::create_array_authors(), "heading" => "Autors Filter:", "description" => "", "holder" => "div", "class" => ""), array("param_name" => "hide_title", "type" => "dropdown", "value" => array('- Show title -' => '', 'Hide title' => 'hide_title'), "heading" => __("Hide block title:", TD_THEME_NAME), "description" => "", "holder" => "div", "class" => ""), array("param_name" => "installed_post_types", "type" => "textfield", "value" => '', "heading" => __("Post Type:", TD_THEME_NAME), "description" => "Usage: post OR post,events,pages ; write 1 or more post types delimited by comas", "holder" => "div", "class" => ""));
     //end generic array
 }
                        </ul>
                    ', 'right');
?>
            </span>
            <?php 
$mb->the_field('td_primary_cat');
?>
            <div class="td-select-style-overwrite td-inline-block-wrap">
                <select name="<?php 
$mb->the_name();
?>
" class="td-panel-dropdown">
                    <option value="">Auto select a category</option>
                    <?php 
$td_current_categories = td_util::get_category2id_array(false);
//print_r($td_current_categories);
//die;
foreach ($td_current_categories as $td_category => $td_category_id) {
    ?>
                        <option value="<?php 
    echo $td_category_id;
    ?>
"<?php 
    $mb->the_select_state($td_category_id);
    ?>
><?php 
    echo $td_category;
    ?>
</option>
                    <?php 
    /**
     * render the categories forms
     */
    static function render_categories_form()
    {
        //get all categories from database
        $categories = get_categories(array('hide_empty' => 0));
        $td_category_walker_panel = new td_category_walker_panel();
        $td_category_walker_panel->walk($categories, 4);
        //print_r($rawalker->td_category_buffer);
        //die;
        //get_categories(array('hide_empty' => 0));//wordpress way
        $categories = td_util::get_category2id_array(false);
        //our function
        foreach ($td_category_walker_panel->td_category_buffer as $display_category_name => $category_id) {
            ?>
            <!-- LAYOUT SETTINGS -->
            <?php 
            echo td_panel_generator::box_start($display_category_name, false);
            ?>

                <!-- DISPLAY VIEW -->
                <div class="td-box-row">
                    <div class="td-box-description">
                        <span class="td-box-title">ARTICLE DISPLAY VIEW</span>
                        <p>Select a module type, this is how your article list will be displayed</p>
                    </div>
                    <div class="td-box-control-full td-panel-module">
                        <?php 
            echo td_panel_generator::visual_select_o(array('ds' => 'td_category', 'item_id' => $category_id, 'option_id' => 'tdc_layout', 'values' => array(array('text' => '', 'title' => '', 'val' => '', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-default.png'), array('text' => '', 'title' => '', 'val' => '1', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-1.png'), array('text' => '', 'title' => '', 'val' => '2', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-2.png'), array('text' => '', 'title' => '', 'val' => '3', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-3.png'), array('text' => '', 'title' => '', 'val' => '4', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-4.png'), array('text' => '', 'title' => '', 'val' => '5', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-5.png'), array('text' => '', 'title' => '', 'val' => '6', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-6.png'), array('text' => '', 'title' => '', 'val' => '7', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-7.png'), array('text' => '', 'title' => '', 'val' => '8', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-8.png'), array('text' => '', 'title' => '', 'val' => '9', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-9.png'), array('text' => '', 'title' => '', 'val' => 'search', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/module-10.png'))));
            ?>
                    </div>
                </div>

                <!-- Custom Sidebar + position -->
                <div class="td-box-row">
                    <div class="td-box-description">
                        <span class="td-box-title">CUSTOM SIDEBAR + POSITION</span>
                        <p>Sidebar position and custom sidebars</p>
                    </div>
                    <div class="td-box-control-full td-panel-sidebar-pos">
                        <div class="td-display-inline-block">
                            <?php 
            echo td_panel_generator::visual_select_o(array('ds' => 'td_category', 'item_id' => $category_id, 'option_id' => 'tdc_sidebar_pos', 'values' => array(array('text' => '', 'title' => '', 'val' => '', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/sidebar-default.png'), array('text' => '', 'title' => '', 'val' => 'sidebar_left', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/sidebar-left.png'), array('text' => '', 'title' => '', 'val' => 'no_sidebar', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/sidebar-full.png'), array('text' => '', 'title' => '', 'val' => 'sidebar_right', 'img' => get_template_directory_uri() . '/wp-admin/images/panel/sidebar-right.png'))));
            ?>
                            <div class="td-panel-control-comment td-text-align-right">Select sidebar position</div>
                        </div>
                        <div class="td-display-inline-block td_sidebars_pulldown_align">
                            <?php 
            echo td_panel_generator::sidebar_pulldown(array('ds' => 'td_category', 'item_id' => $category_id, 'option_id' => 'tdc_sidebar_name'));
            ?>
                            <div class="td-panel-control-comment td-text-align-right">Create or select an existing sidebar</div>
                        </div>
                    </div>
                </div>

                <!-- Show Featured slider -->
                <div class="td-box-row">
                    <div class="td-box-description">
                        <span class="td-box-title">SHOW FEATURED SLIDER</span>
                        <p>Enable or disable the featured slider (only posts that are in the Featured category are showed in slider)</p>
                    </div>
                    <div class="td-box-control-full">
                        <?php 
            echo td_panel_generator::checkbox(array('ds' => 'td_category', 'item_id' => $category_id, 'option_id' => 'tdc_slider', 'true_value' => '', 'false_value' => 'yes'));
            ?>
                    </div>
                </div>

                <!-- Category color -->
                <div class="td-box-row">
                    <div class="td-box-description">
                        <span class="td-box-title">CATEGORY TAG COLOR ON POST PAGE</span>
                        <p>Pick a color for this category tag on post page</p>
                    </div>
                    <div class="td-box-control-full">
                        <?php 
            echo td_panel_generator::color_piker(array('ds' => 'td_category', 'item_id' => $category_id, 'option_id' => 'tdc_color', 'default_color' => ''));
            ?>
                    </div>
                </div>

                <!-- BACKGROUND UPLOAD -->
                <div class="td-box-row">
                    <div class="td-box-description">
                        <span class="td-box-title">BACKGROUND UPLOAD</span>
                        <p>Upload your logo (300 x 100px) .png</p>
                    </div>
                    <div class="td-box-control-full">
                        <?php 
            echo td_panel_generator::upload_image(array('ds' => 'td_category', 'item_id' => $category_id, 'option_id' => 'tdc_image'));
            ?>
                    </div>
                </div>

                <!-- BACKGROUND STYLE -->
                <div class="td-box-row">
                    <div class="td-box-description">
                        <span class="td-box-title">BACKGROUND STYLE</span>
                        <p>How the background will be dispalyed</p>
                    </div>
                    <div class="td-box-control-full">
                        <?php 
            echo td_panel_generator::radio_button_control(array('ds' => 'td_category', 'item_id' => $category_id, 'option_id' => 'tdc_bg_repeat', 'values' => array(array('text' => 'Default', 'val' => ''), array('text' => 'Stretch', 'val' => 'stretch'), array('text' => 'Tiled', 'val' => 'tile'))));
            ?>
                    </div>
                </div>

                <!-- Background color -->
                <div class="td-box-row">
                    <div class="td-box-description">
                        <span class="td-box-title">BACKGROUND COLOR</span>
                        <p>Use a solid color instead of an image</p>
                    </div>
                    <div class="td-box-control-full">
                        <?php 
            echo td_panel_generator::color_piker(array('ds' => 'td_category', 'item_id' => $category_id, 'option_id' => 'tdc_bg_color', 'default_color' => ''));
            ?>
                    </div>
                </div>

                <!-- Hide category tag on post -->
                <div class="td-box-row">
                    <div class="td-box-description">
                        <span class="td-box-title">HIDE CATEGORY TAG ON POST</span>
                        <p>Show or hide category tags on post page</p>
                    </div>
                    <div class="td-box-control-full">
                        <?php 
            echo td_panel_generator::checkbox(array('ds' => 'td_category', 'item_id' => $category_id, 'option_id' => 'tdc_hide_on_post', 'true_value' => 'hide', 'false_value' => ''));
            ?>
                    </div>
                </div>

            <?php 
            echo td_panel_generator::box_end();
        }
        //end foreach
    }
Exemple #7
0
 /**
  * the filter array (used by blocks and by the loop filters)
  * @return array
  */
 static function get_map_filter_array($group = 'Filter')
 {
     return array(array("param_name" => "category_id", "type" => "dropdown", "value" => td_util::get_category2id_array(), "heading" => 'Category filter:', "description" => "A single category filter. If you want to filter multiple categories, use the 'Multiple categories filter' and leave this to default", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "category_ids", "type" => "textfield", "value" => '', "heading" => 'Multiple categories filter:', "description" => "Filter multiple categories by ID. Enter here the category IDs separated by commas (ex: 13,23,18). To exclude categories from this block add them with '-' (ex: -9, -10)", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "tag_slug", "type" => "textfield", "value" => '', "heading" => 'Filter by tag slug:', "description" => "To filter multiple tag slugs, enter here the tag slugs separated by commas (ex: tag1,tag2,tag3)", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "autors_id", "type" => "textfield", "value" => '', "heading" => "Multiple authors filter:", "description" => "Filter multiple authors by ID. Enter here the author IDs separated by commas (ex: 13,23,18).", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "installed_post_types", "type" => "textfield", "value" => '', "heading" => 'Post Type:', "description" => "Filter by post types. Usage: post, page, event - Write 1 or more post types delimited by commas", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "sort", "type" => "dropdown", "value" => array('- Latest -' => '', 'Random posts Today' => 'random_today', 'Random posts from last 7 Day' => 'random_7_day', 'Alphabetical A -> Z' => 'alphabetical_order', 'Popular (all time)' => 'popular', 'Popular (last 7 days; enable first from ' . TD_THEME_NAME . ' Panel -> Block settings -> 7 days post sorting)' => 'popular7', 'Featured' => 'featured', 'Highest rated (reviews)' => 'review_high', 'Random Posts' => 'random_posts', 'Most Commented' => 'comment_count'), "heading" => 'Sort order:', "description" => "How to sort the posts.", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "limit", "type" => "textfield", "value" => '5', "heading" => 'Limit post number:', "description" => "If the field is empty the limit post number will be the number from Wordpress settings -> Reading", "holder" => "div", "class" => ""), array("param_name" => "offset", "type" => "textfield", "value" => '', "heading" => 'Offset posts:', "description" => "Start the count with an offset. If you have a block that shows 5 posts before this one, you can make this one start from the 6'th post (by using offset 5)", "holder" => "div", "class" => ""));
     //end generic array
 }
 /**
  * the filter array (used by blocks and by the loop filters)
  * @return array
  */
 static function get_map_filter_array($group = '筛选')
 {
     return array(array("param_name" => "category_id", "type" => "dropdown", "value" => td_util::get_category2id_array(), "heading" => '分类筛选:', "description" => "单个分类筛选。如果你想筛选多个分类,使用 '多个分类筛选' 并留此为默认", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "category_ids", "type" => "textfield", "value" => '', "heading" => '多分类筛选:', "description" => "按ID筛选多个分类。用逗号分隔分类ID(13,23,18)。要从此区块排除分类,使用 '-' 添加它们 (例如: -9, -10)", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "tag_slug", "type" => "textfield", "value" => '', "heading" => '按标签别名筛选:', "description" => "要筛选多个标签别名,用逗号分隔标签别名 (例如: tag1,tag2,tag3)", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "autors_id", "type" => "textfield", "value" => '', "heading" => "多个作者筛选:", "description" => "按ID筛选多个作者。用逗号分隔作者ID(例如:13,23,18).", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "installed_post_types", "type" => "textfield", "value" => '', "heading" => '文章类型:', "description" => "按文章类型筛选。用法:文章、作者、页面、事件 - 写1或更多文章类型用逗号分隔", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "sort", "type" => "dropdown", "value" => array('- 最新 -' => '', '随机文章今天' => 'random_today', '随机文章最新7天' => 'random_7_day', '字母 A -> Z' => 'alphabetical_order', '热门 (所有时间)' => 'popular', '热门 (整站) - jetpack + stats module required' => 'jetpack_popular_2', '热门 (最后7天) - theme counter (enable from panel)' => 'popular7', '精选' => 'featured', '评分最高 (点评)' => 'review_high', '随机文章' => 'random_posts', '最多评论' => 'comment_count'), "heading" => '排序顺序:', "description" => "如何排序文章。注意,热门(最后7天)选项受缓存插件和CDN的影响。热门文章推荐 jetpack (24-48小时) 方法", "holder" => "div", "class" => "", 'group' => $group), array("param_name" => "limit", "type" => "textfield", "value" => '5', "heading" => '限制文章数:', "description" => "如果字段为空,限制文章数将为Wordpress设置 -> 阅读 的数量", "holder" => "div", "class" => ""), array("param_name" => "offset", "type" => "textfield", "value" => '', "heading" => '偏移文章:', "description" => "一个偏移数量开始。如果区块显示5个文章在这一个之前,你可以从第6个文章开始(使用偏移5)", "holder" => "div", "class" => ""));
     //end generic array
 }