Answer the question
In order to leave comments, you need to log in
How to create sql query in wordpress
The WP-Recall
plugin works for me. The plugin displays its chat (comments) for posts with the following code:
<?php global $post; echo do_shortcode('[rcl-chat chat_room="post-'.$post->ID.'" userslist="1"]'); ?>
SELECT * FROM `wp_rcl_chat_messages` AS t_mess
LEFT JOIN `wp_rcl_chats` AS t_chat
ON t_chat.chat_id = t_mess.chat_id
WHERE t_chat.chat_room = 'fchat'
ORDER BY t_mess.message_id DESC
LIMIT 1
global $wpdb;
$wpdb->query("
SELECT * FROM `wp_rcl_chat_messages` AS t_mess
LEFT JOIN `wp_rcl_chats` AS t_chat
ON t_chat.chat_id = t_mess.chat_id
WHERE t_chat.chat_room = '.$post->ID.'
ORDER BY t_mess.message_id DESC
LIMIT 1
");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question