Textdoc
Zipdoc
Writeurl
Loading…
'shoofkoora_main_options_page', 'title' => 'اعدادت القالب', 'object_types' => array( 'options-page' ), 'option_key' => 'shoofkoora_options', 'tab_group' => 'shoofkoora_main_options', 'tab_title' => 'اعدادت الثيم', ); // 'tab_group' property is supported in > 2.4.0. if ( version_compare( CMB2_VERSION, '2.4.0' ) ) { $args['display_cb'] = 'shoofkoora_options_display_with_tabs'; } $main_options = new_cmb2_box( $args ); /** * Options fields ids only need * to be unique within this box. * Prefix is not needed. */ $main_options->add_field( array( 'name' => __( 'لون الخلفية', 'shoofkoora' ), 'desc' => __( 'لون الخلفية مثال #f3f4f5', 'shoofkoora' ), 'id' => 'bg_color', 'type' => 'colorpicker', 'default' => '#f3f4f5', ) ); $main_options->add_field( array( 'name' => __( 'لون ثيم الموقع', 'shoofkoora' ), 'desc' => __( ' لون الموقع مثال #16296c', 'shoofkoora' ), 'id' => 'main_color', 'type' => 'colorpicker', 'default' => '#16296c', ) ); $main_options->add_field( array( 'name' => __( 'لون اللون الثانوي للموقع', 'shoofkoora' ), 'desc' => __( 'مثال #ff2300', 'shoofkoora' ), 'id' => 'scound_color', 'type' => 'colorpicker', 'default' => '#ff2300', ) ); $main_options->add_field( array( 'name' => __( 'رابط اعلانات VMAP', 'shoofkoora' ), 'desc' => __( ' اعلانات VMAP على المشغل', 'shoofkoora' ), 'id' => 'VMAP_url', 'type' => 'text_url', 'default' => 'https://www.videosprofitnetwork.com/watch.xml?key=1569eeef53a603dcdafcbfd76b571022', ) ); $main_options->add_field( array( 'name' => __( 'إخفاء بطاقة المبارة', 'shoofkoora' ), 'desc' => __( 'إخفاء', 'shoofkoora' ), 'id' => 'match_card', 'type' => 'checkbox', ) ); $main_options->add_field( array( 'name' => __( 'بطاقة المبارة', 'shoofkoora' ), 'id' => 'match_card', 'type' => 'radio_inline', 'options' => array( 'hide' => __( 'إخفاء', 'shoofkoora' ), 'show' => __( 'عرض', 'shoofkoora' ), ), 'default' => 'show', ) ); /** * Registers secondary options page, and set main item as parent. */ $args = array( 'id' => 'shoofkoora_secondary_options_page', 'menu_title' => 'تفعيل القالب', // Use menu title, & not title to hide main h2. 'object_types' => array( 'options-page' ), 'option_key' => 'shoofkoora_secondary_options', 'parent_slug' => 'shoofkoora_options', 'tab_group' => 'shoofkoora_main_options', 'tab_title' => 'اعداد التفعيل', ); // 'tab_group' property is supported in > 2.4.0. if ( version_compare( CMB2_VERSION, '2.4.0' ) ) { $args['display_cb'] = 'shoofkoora_options_display_with_tabs'; } $secondary_options = new_cmb2_box( $args ); $secondary_options->add_field( array( 'name' => 'Test Radio', 'desc' => 'field description (optional)', 'id' => 'radio', 'type' => 'radio', 'options' => array( 'option1' => 'Option One', 'option2' => 'Option Two', 'option3' => 'Option Three', ), ) ); } add_action( 'cmb2_admin_init', 'shoofkoora_register_main_options_metabox' ); /** * A CMB2 options-page display callback override which adds tab navigation among * CMB2 options pages which share this same display callback. * * @param CMB2_Options_Hookup $cmb_options The CMB2_Options_Hookup object. */ function shoofkoora_options_display_with_tabs( $cmb_options ) { $tabs = shoofkoora_options_page_tabs( $cmb_options ); ?>
$tab_title ) : ?>
options_page_metabox(); ?> cmb->prop( 'save_button' ) ), 'primary', 'submit-cmb' ); ?>
cmb->prop( 'tab_group' ); $tabs = array(); foreach ( CMB2_Boxes::get_all() as $cmb_id => $cmb ) { if ( $tab_group === $cmb->prop( 'tab_group' ) ) { $tabs[ $cmb->options_page_keys()[0] ] = $cmb->prop( 'tab_title' ) ? $cmb->prop( 'tab_title' ) : $cmb->prop( 'title' ); } } return $tabs; } /** * Wrapper function around cmb2_get_option * @since 0.1.0 * @param string $key Options array key * @param mixed $default Optional default value * @return mixed Option value */ function shoofkoora_get_option( $key = '', $main_options = false ) { if ( function_exists( 'cmb2_get_option' ) ) { // Use cmb2_get_option as it passes through some key filters. return cmb2_get_option( 'shoofkoora_options', $key, $main_options ); } // Fallback to get_option if CMB2 is not loaded yet. $opts = get_option( 'shoofkoora_options', $main_options ); $val = $main_options; if ( 'all' == $key ) { $val = $opts; } elseif ( is_array( $opts ) && array_key_exists( $key, $opts ) && false !== $opts[ $key ] ) { $val = $opts[ $key ]; } return $val; } // الحقول add_action( 'cmb2_admin_init', 'post_info_meta_box' );