HEX
Server: nginx/1.28.1
System: Linux iZgw8b5bpgd4jyptfmmmxgZ 6.6.102-5.2.alnx4.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 27 23:11:10 CST 2025 x86_64
User: www (1000)
PHP: 8.2.28
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.scdc-marine.com/wp-content/themes/scdc-marine/HekuClass/Admin/Cmb2Taxonomies.php
<?php 
namespace Heku\HekuClass\Admin;

/**
 * @package     Heku\HekuClass\Admin
 * @subpackage  Classes/Cmb2Taxonomies
 * @author      Heku Daleconan <http://www.daleconan.com>
 * @copyright   Copyright (c) 2022-2023, Heku Daleconan
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 */


class Cmb2Taxonomies{

    private static $instance;

    public static function instance() {
        if ( ! isset( self::$instance ) ) {
            self::$instance = new self;
            self::$instance->init();
        }
        return self::$instance;
    }

    public function init(){

        add_action( 'cmb2_admin_init', array($this,'register_taxonomy_metabox' ));

    }

    // 定位 为 注册到 分类页 和 标签页的 自定义参数
    public function register_taxonomy_metabox(){
        $cmb_term = new_cmb2_box( array( 
            'id'               => 'heku_tax', 
            'title'            => __( 'Tax 设置', 'heku' ), 
            'object_types'     => array( 'term' ), 
            'taxonomies'       => array( 'category', 'post_tag' ),
            'new_term_section' => true,
        ) );

        $cmb_term->add_field(array(
            'id'   => 'global_seo_keywords',
            'before_row'=>'<div id="tag_seo_title" class="cmb-row">',
            'name' => __('SEO 关键词','b2'),
            'type' => 'text',
            'default'=>'',
            'desc'=>__('网站首页的优化关键词,多个关键词请用英文逗号(,)分开,一般不多余8个关键词。调用字段:global_seo_keywords','heku'),
            'after_row'=>'</div>',
        ));

        // $cmb_term->add_field( array( 
        //     'name'     => __( 'SEO 关键词', 'b2' ), 
        //     'id'       => 'seo_keywords', 
        //     'type'     => 'text', 
        // ) );

        //筛选设置
        
        // $filter = $cmb_term->add_field( array(
        //     'id'          => 'b2_filter',
        //     'type'        => 'group',
        //     'desc' => __( '多级筛选设置', 'b2' ),
        //     'repeatable'  => false, 
        //     'options'     => array(
        //         'group_title'       => __( '多级筛选设置设置', 'b2' ),
        //         'add_button'        => __( '添加新模块', 'b2' ),
        //         'remove_button'     => __( '删除模块', 'b2' ),
        //         'sortable'          => false,
        //         'closed'         => false,
        //         'remove_confirm' => __( '确定要删除这个模块吗?', 'b2' ),
        //     ),
        //     'desc'=>sprintf(__('如果需要批量设置多个分类的的筛选,您可以前往%s分类筛选批量设置%s中进行操作','b2'),'<a target="_blank" href="'.admin_url('/admin.php?page=b2_template_fliter').'">','</a>')
        // ));

        // $cmb_term->add_group_field( $filter,array(
        //     'name'    => __( '是否开启筛选', 'b2' ), 
        //     'id'      => 'show',
        //     'type'    => 'select',
        //     'default'          => 0,
        //     'options'          => array(
        //         1 => __( '开启', 'cmb2' ),
        //         0   => __( '关闭', 'cmb2' )
        //     ),
        // ));

        // $cats = array();

        // $categories = get_categories( array(
        //     'orderby' => 'name',
        //     'order'   => 'ASC',
        //     'hide_empty'      => false,
        // ) );
         
        // foreach( $categories as $category ) {
        //     $cats[$category->term_id] = $category->name;
        // } 

        // $cmb_term->add_group_field($filter,array(
        //     'name'    => '允许筛选的分类',
        //     'id'      => 'cat',
        //     'desc'    => __('请选择要显示的文章分类,可以拖动排序','b2'),
        //     'type'    => 'pw_multiselect',
        //     'options' =>$cats,
        // ) );

        // $cmb_term->add_group_field( $filter,array(
        //     'name' => __('允许筛选的分类','b2'),
        //     'id'   => 'cat',
        //     'type' => 'taxonomy_multicheck_hierarchical',
        //     'taxonomy'=>'category',
        //     'text'           => array(
        //         'no_terms_text' => sprintf(__('没有分类,请前往%s添加','b2'),'<a target="__blank" href="'.admin_url('//edit-tags.php?taxonomy=category').'"></a>')
        //     ),
        //     'remove_default' => 'true',
        //     'query_args' => array(
        //         'orderby' => 'count',
        //         'hide_empty' => false,
        //     ),
        //     'select_all_button' => true,
        //     'desc'=>__('请确保您的分类别名不是中文,否则无法选中','b2'),
        // ));

        // $arr = array();

        // $cats = get_terms('collection',array(
        //     'orderby' => 'name',
        //     'order'   => 'ASC',
        //     'hide_empty'      => false,
        //     'cache_domain'=>'b2_collection'
        // ) );

    }

}