public function ap_show_conversation() { $args = explode('-', sanitize_text_field($_POST['args'])); if (wp_verify_nonce($args[0], 'show-conversation')) { $id = sanitize_text_field($args[1]); ob_start(); ap_get_conversation_list($id); $html = ob_get_clean(); $result = array('status' => true, 'html' => $html, 'message' => __('Conversation loaded', 'ap')); } else { $result = array('status' => false, 'message' => __('Failed to load conversation', 'ap')); } die(json_encode($result)); }
<div id="ap-message"> <div class="ap-conversation"> <?php echo ap_get_conversation_list($message_id); ?> </div> </div>