post_status == 'publish' ) { foreach ( $this->screens as $screen ) { add_meta_box( 'shortcodes', __( 'Coupon Shortcodes', 'affcoupon' ), array( $this, 'add_meta_box_callback' ), $screen, 'side', 'high' ); } } } /** * Generates the HTML for the meta box * * @param object $post WordPress post object * * @since 1.0 */ public function add_meta_box_callback( $post ) { wp_nonce_field( 'shortcodes_data', 'shortcodes_nonce' ); $this->generate_fields( $post ); } /** * Generates the field's HTML for the meta box. * * @since 1.0 */ public function generate_fields( $post ) { $output = ''; $output .= '' . esc_html__( 'Full Coupon', 'affcoupon' ) . ': [affcoupon id=' . (int) $post->ID . ']' . '

'; $output .= '' . esc_html__( 'Only Coupon Code', 'affcoupon' ) . ': [affcoupon_btn id=' . (int) $post->ID . ']'; echo wp_kses_post( $output ); } }