| @@ -22,8 +22,9 @@ | ||
| 22 | 22 | * @since 1.9.6 |
| 23 | 23 | */ |
| 24 | 24 | public function __construct() { |
| 25 | 25 | |
| 26 | + add_action( 'post_submitbox_misc_actions', array( $this, 'output_pre_publish_actions' ) ); | |
| 26 | 27 | add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); |
| 27 | 28 | add_action( 'save_post', array( $this, 'save_post_meta' ) ); |
| 28 | 29 | |
| 29 | 30 | } |
| @@ -68,8 +69,39 @@ | ||
| 68 | 69 | * |
| 69 | 70 | * @since 1.9.6.4 |
| 70 | 71 | */ |
| 71 | 72 | do_action( 'convertkit_admin_post_enqueue_styles' ); |
| 73 | + | |
| 74 | + } | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * Registers actions in the pre-publish actions section of the Publish metabox | |
| 78 | + * in the Classic Editor. | |
| 79 | + * | |
| 80 | + * @since 2.4.0 | |
| 81 | + * | |
| 82 | + * @param WP_Post $post WordPress Post. | |
| 83 | + */ | |
| 84 | + public function output_pre_publish_actions( $post ) { | |
| 85 | + | |
| 86 | + // Bail if no actions registered. | |
| 87 | + $pre_publish_actions = convertkit_get_pre_publish_actions(); | |
| 88 | + if ( ! count( $pre_publish_actions ) ) { | |
| 89 | + return; | |
| 90 | + } | |
| 91 | + | |
| 92 | + // Bail if Post is not a supported Post Type. | |
| 93 | + if ( get_post_type( $post ) !== 'post' ) { | |
| 94 | + return; | |
| 95 | + } | |
| 96 | + | |
| 97 | + // Bail if Post is not a draft. | |
| 98 | + if ( ! in_array( $post->post_status, array( 'draft', 'auto-draft' ), true ) ) { | |
| 99 | + return; | |
| 100 | + } | |
| 101 | + | |
| 102 | + // Load pre-publish actions view. | |
| 103 | + include CONVERTKIT_PLUGIN_PATH . '/views/backend/post/pre-publish-actions.php'; | |
| 72 | 104 | |
| 73 | 105 | } |
| 74 | 106 | |
| 75 | 107 | /** |