Inventory_Presser_Classic_Editor::add_hooks_current_screen()


Source

File: includes/integrations/class-classic-editor.php

	public function add_hooks_current_screen() {
		// Are we editing a vehicle in the Classic Editor?
		if ( ! is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
			// No. Classic Editor plugin is not active.
			return;
		}
		global $pagenow, $current_screen;
		if ( ( $pagenow !== 'post.php' || INVP::POST_TYPE !== $current_screen->post_type ) ) {
			// No. Not editing a vehicle.
			return;
		}

		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes_to_cpt' ) );

		// Move all "advanced" meta boxes above the default editor
		// http://wordpress.stackexchange.com/a/88103
		add_action( 'edit_form_after_title', array( $this, 'move_advanced_meta_boxes' ) );

		// Move the "Tags" metabox below the meta boxes for vehicle custom taxonomies
		add_action( 'add_meta_boxes', array( $this, 'move_tags_meta_box' ), 0 );

		// Load our scripts
		add_action( 'admin_enqueue_scripts', array( $this, 'scripts_and_styles' ) );

		// Add some content next to the "Add Media" button
		add_action( 'media_buttons', array( $this, 'annotate_add_media_button' ) );

		// Define an AJAX handler for the 'Delete All Media' button
		add_filter( 'wp_ajax_delete_all_post_attachments', array( $this, 'delete_all_post_attachments' ) );

		// Make our Add Media button annotation available from an AJAX call
		add_action( 'wp_ajax_output_add_media_button_annotation', array( $this, 'output_add_media_button_annotation' ) );
	}