'h3', 'id' => 0, ), $user_defined_atts, $shortcode_name ); $attributes['id'] = (int) $attributes['id']; if ( $attributes['id'] < 1 ) { return ''; } cp_enqueue_scripts(); ob_start(); render_coupon_single( $attributes ); return ob_get_clean(); } /** * Enqueue Javascript Only On Shortcode Pages * * @since 1.0.0 * * @return void */ function cp_enqueue_scripts() { wp_enqueue_style( 'dashicons' ); wp_enqueue_script( 'couponplugin-js' ); } /** * Render Single coupon * * @since 1.0.0 * * @param array $attributes comes form shortcode processing. * * @return void */ function render_coupon_single( $attributes ) { $coupon = get_post( $attributes['id'] ); if ( ! $coupon ) { return; } if ( ! ( get_post_status( $coupon->ID ) == 'publish' ) ) { return; } $title = $coupon->post_title; $id = $attributes['id']; include( AFFILIATE_COUPON_LITE_PATH . 'src/custom/shortcode/helpers/meta-loading.php' ); include( AFFILIATE_COUPON_LITE_PATH . 'src/custom/shortcode/views/coupon.php' ); }