post_content, 'adambox' ) ) { return; } $css_path = ADAMBOX_PLUGIN_DIR . 'assets/css/adambox.css'; $js_path = ADAMBOX_PLUGIN_DIR . 'assets/js/adambox.js'; wp_enqueue_style( 'adambox', ADAMBOX_PLUGIN_URL . 'assets/css/adambox.css', array(), file_exists( $css_path ) ? filemtime( $css_path ) : ADAMBOX_VERSION ); wp_enqueue_script( 'adambox', ADAMBOX_PLUGIN_URL . 'assets/js/adambox.js', array(), file_exists( $js_path ) ? filemtime( $js_path ) : ADAMBOX_VERSION, true ); wp_localize_script( 'adambox', 'AdamBoxConfig', array( 'restUrl' => esc_url_raw( rest_url( 'adambox/v1' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'maxMsgs' => 10, 'version' => ADAMBOX_VERSION, ) ); } public function render_shortcode( $atts ) { $atts = shortcode_atts( array( 'title' => __( 'AdamBox', 'adambox' ), 'placeholder' => __( 'Type a message…', 'adambox' ), 'button' => __( 'Send', 'adambox' ), ), $atts, 'adambox' ); $post_id = get_the_ID(); if ( ! $post_id ) { return ''; } $instance_id = 'adambox-' . $post_id; ob_start(); ?>