id !== 'edit-ogf_custom_fonts' ) { return; } wp_enqueue_style( 'olympus-google-fonts-admin', plugins_url( 'admin/style.css', __DIR__ ), false, '1.0.0' ); wp_enqueue_media(); wp_enqueue_script( 'olympus-google-fonts-upload', plugins_url( 'assets/js/uploadFonts.js', __DIR__ ), array(), '1.0.1' ); } /** * Register custom font menu */ public function register_custom_fonts_menu() { $title = apply_filters( 'ogf_custom_fonts_menu_title', __( 'Upload Fonts', 'olympus-google-fonts' ) ); add_submenu_page( $this->parent_menu_slug, $title, $title, OGF_Fonts_Taxonomy::$capability, 'edit-tags.php?taxonomy=' . OGF_Fonts_Taxonomy::$taxonomy_slug ); } /** * Modify taxonomy output. */ public function customize_output() { global $parent_file, $submenu_file; if ( 'edit-tags.php?taxonomy=' . OGF_Fonts_Taxonomy::$taxonomy_slug === $submenu_file ) { $parent_file = $this->parent_menu_slug; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited } if ( get_current_screen()->id != 'edit-' . OGF_Fonts_Taxonomy::$taxonomy_slug ) { return; } ?>
base ) && 'edit-tags' == $screen->base ) { $old_columns = $columns; $columns = array( 'cb' => $old_columns['cb'], 'name' => $old_columns['name'], ); } return $columns; } /** * Add options page */ public function intro_text() { echo '>Documentation for this feature is available here: Upload Fonts to WordPress.font_family_new_field( 'family', __( 'Font Family', 'olympus-google-fonts' ), __( 'The name of the font family. For example, Helvetica or Proxima Nova.', 'olympus-google-fonts' ) ); $this->font_file_new_field( 'woff', __( 'WOFF Font File', 'olympus-google-fonts' ), '' ); $this->font_file_new_field( 'woff2', __( 'WOFF2 Font File', 'olympus-google-fonts' ), '' ); $this->font_file_new_field( 'otf', __( 'OpenType (.otf) Font File', 'olympus-google-fonts' ), '' ); $this->font_file_new_field( 'ttf', __( 'TrueType (.ttf) Font File', 'olympus-google-fonts' ), '' ); $this->font_weight_new_field( 'weight', __( 'Font Weight', 'olympus-google-fonts' ), '' ); $this->font_style_new_field( 'style', __( 'Font Style', 'olympus-google-fonts' ), '' ); } /** * Edit Taxonomy data * * @param object $term taxonomy terms. */ public function edit_taxonomy_data( $term ) { $data = OGF_Fonts_Taxonomy::get_font_data( $term->term_id ); $this->font_family_edit_field( 'family', __( 'Font Family', 'olympus-google-fonts' ), $data['family'], __( 'The name of the font family. For example, Helvetica or Proxima Nova.', 'olympus-google-fonts' ) ); $this->font_file_edit_field( 'woff', __( 'Font .woff', 'olympus-google-fonts' ), $data['woff'], __( 'Upload the font\'s .woff file or enter the URL.', 'olympus-google-fonts' ) ); $this->font_file_edit_field( 'woff2', __( 'Font .woff2', 'olympus-google-fonts' ), $data['woff2'], __( 'Upload the font\'s .woff2 file or enter the URL.', 'olympus-google-fonts' ) ); $this->font_file_edit_field( 'ttf', __( 'Font .ttf', 'olympus-google-fonts' ), $data['ttf'], __( 'Upload the font\'s .ttf file or enter the URL.', 'olympus-google-fonts' ) ); $this->font_file_edit_field( 'otf', __( 'Font .otf', 'olympus-google-fonts' ), $data['otf'], __( 'Upload the font\'s .otf file or enter the URL.', 'olympus-google-fonts' ) ); $this->font_weight_edit_field( 'weight', __( 'Font Weight', 'olympus-google-fonts' ), $data['weight'] ); $this->font_style_edit_field( 'style', __( 'Font Weight', 'olympus-google-fonts' ), $data['style'] ); $this->font_preload_edit_field( 'preload', __( 'Preload Font', 'olympus-google-fonts' ), $data['preload'], __( 'Preloading is a Fonts Plugin Pro feature.', 'olympus-google-fonts' ) ); } /** * Add Taxonomy data field * * @param string $id current term id. * @param string $title font type title. * @param string $description title font type description. */ protected function font_family_new_field( $id, $title, $description = '' ) { ?>