base ) && 'edit-tags' == $screen->base ) { $old_columns = $columns; $columns = array( 'cb' => $old_columns['cb'], 'name' => $old_columns['name'], ); } return $columns; } /** * Add new taxonomy data. */ public function add_new_taxonomy_data() { $this->add_new_taxonomy_default_data(); ?>
'; $this->add_new_taxonomy_repeater_data(); wp_nonce_field( basename( __FILE__ ), 'bsf_custom_font_nonce' ); echo '
Remove
Add Font Variation
'; } /** * Add new Taxonomy data * * @since 1.0.0 */ public function add_new_taxonomy_default_data() { $this->font_new_field( 'font_fallback', __( 'Font Fallback', 'custom-fonts' ), __( 'Add the font\'s fallback names with comma(,) separator. eg. Arial, Serif', 'custom-fonts' ) ); $this->select_default_new_field( 'font-display', __( 'Font Display', 'custom-fonts' ), __( 'Select font-display property for this font', 'custom-fonts' ), array( 'auto' => 'auto', 'block' => 'block', 'swap' => 'swap', 'fallback' => 'fallback', 'optional' => 'optional', ) ); } /** * Add new Taxonomy data * * @since 1.0.0 */ public function add_new_taxonomy_repeater_data() { $this->select_new_field( 'font-weight-0', __( 'Font weight', 'custom-fonts' ), __( 'Select font-weight property for this font', 'custom-fonts' ), array( '100' => __( 'Thin 100', 'custom-fonts' ), '200' => __( 'Extra-Light 200', 'custom-fonts' ), '300' => __( 'Light 300', 'custom-fonts' ), '400' => __( 'Normal 400', 'custom-fonts' ), '500' => __( 'Medium 500', 'custom-fonts' ), '600' => __( 'Semi-Bold 600', 'custom-fonts' ), '700' => __( 'Bold 700', 'custom-fonts' ), '800' => __( 'Extra-Bold 800', 'custom-fonts' ), '900' => __( 'Ultra-Bold 900', 'custom-fonts' ), ) ); $this->font_file_new_field( 'font_woff_2-0', __( 'Font .woff2', 'custom-fonts' ), __( 'Upload the font\'s woff2 file or enter the URL.', 'custom-fonts' ) ); $this->font_file_new_field( 'font_woff-0', __( 'Font .woff', 'custom-fonts' ), __( 'Upload the font\'s woff file or enter the URL.', 'custom-fonts' ) ); $this->font_file_new_field( 'font_ttf-0', __( 'Font .ttf', 'custom-fonts' ), __( 'Upload the font\'s ttf file or enter the URL.', 'custom-fonts' ) ); $this->font_file_new_field( 'font_eot-0', __( 'Font .eot', 'custom-fonts' ), __( 'Upload the font\'s eot file or enter the URL.', 'custom-fonts' ) ); $this->font_file_new_field( 'font_svg-0', __( 'Font .svg', 'custom-fonts' ), __( 'Upload the font\'s svg file or enter the URL.', 'custom-fonts' ) ); $this->font_file_new_field( 'font_otf-0', __( 'Font .otf', 'custom-fonts' ), __( 'Upload the font\'s otf file or enter the URL.', 'custom-fonts' ) ); } /** * Edit taxonomy data. * * @param object $term Term data. */ public function edit_new_taxonomy_data( $term ) { $data = Bsf_Custom_Fonts_Taxonomy::get_font_links( $term->term_id ); $this->edit_new_taxonomy_default_data( $term ); ?>
$value ) { ?> edit_taxonomy_repeater_data( $key, $value ); ?>
Add Font Variation
term_id ); $this->font_edit_field( 'font_fallback', __( 'Font Fallback', 'custom-fonts' ), __( 'Add the font\'s fallback names with comma(,) separator. eg. Arial, Serif', 'custom-fonts' ), $data['font_fallback'] ); $this->select_default_edit_field( 'font-display', __( 'Font Display', 'custom-fonts' ), __( 'Select font-display property for this font', 'custom-fonts' ), array( 'auto' => 'Auto', 'block' => 'Block', 'swap' => 'Swap', 'fallback' => 'Fallback', 'optional' => 'Optional', ), $data['font-display'] ); } /** * Edit Taxonomy data * * @since 1.0.0 * @param string $key Font array repeater fields key. * @param string $value Font array repeater fields value. */ public function edit_taxonomy_repeater_data( $key, $value ) { if ( strpos( $key, 'font-weight' ) !== false ) { ?>
select_new_field( $key, __( 'Font weight', 'custom-fonts' ), __( 'Select font-weight property for this font', 'custom-fonts' ), array( '100' => __( 'Thin 100', 'custom-fonts' ), '200' => __( 'Extra-Light 200', 'custom-fonts' ), '300' => __( 'Light 300', 'custom-fonts' ), '400' => __( 'Normal 400', 'custom-fonts' ), '500' => __( 'Medium 500', 'custom-fonts' ), '600' => __( 'Semi-Bold 600', 'custom-fonts' ), '700' => __( 'Bold 700', 'custom-fonts' ), '800' => __( 'Extra-Bold 800', 'custom-fonts' ), '900' => __( 'Ultra-Bold 900', 'custom-fonts' ), ), $value ); self::$edit_repeater_field_count++; } elseif ( strpos( $key, 'font_woff_2-' ) !== false ) { $this->font_file_edit_field( 'font_woff_2', __( 'Font .woff2', 'custom-fonts' ), __( 'Upload the font\'s woff2 file or enter the URL.', 'custom-fonts' ), $value, $key ); } elseif ( strpos( $key, 'font_woff-' ) !== false ) { $this->font_file_edit_field( 'font_woff', __( 'Font .woff', 'custom-fonts' ), __( 'Upload the font\'s woff file or enter the URL.', 'custom-fonts' ), $value, $key ); } elseif ( strpos( $key, 'font_ttf' ) !== false ) { $this->font_file_edit_field( 'font_ttf', __( 'Font .ttf', 'custom-fonts' ), __( 'Upload the font\'s ttf file or enter the URL.', 'custom-fonts' ), $value, $key ); } elseif ( strpos( $key, 'font_eot' ) !== false ) { $this->font_file_edit_field( 'font_eot', __( 'Font .eot', 'custom-fonts' ), __( 'Upload the font\'s eot file or enter the URL.', 'custom-fonts' ), $value, $key ); } elseif ( strpos( $key, 'font_svg' ) !== false ) { $this->font_file_edit_field( 'font_svg', __( 'Font .svg', 'custom-fonts' ), __( 'Upload the font\'s svg file or enter the URL.', 'custom-fonts' ), $value, $key ); } elseif ( strpos( $key, 'font_otf' ) !== false ) { $this->font_file_edit_field( 'font_otf', __( 'Font .otf', 'custom-fonts' ), __( 'Upload the font\'s otf file or enter the URL.', 'custom-fonts' ), $value, $key ); ?>
Remove