Is it possible in Wordpress to return the total number of results from $wpdb->get_results ignoring the limit?
Example:
$datas = $wpdb->get_results("
SELECT DISTINCT wp_posts.ID, wp_posts.post_title, wp_posts.post_excerpt FROM wp_posts
INNER JOIN wp_postmeta ON
wp_posts.ID = wp_postmeta.post_id
WHERE (
wp_posts.post_title LIKE '%hello%' OR
wp_postmeta.meta_value LIKE '%hello%'
)
AND wp_posts.post_status = 'publish'
AND wp_posts.post_type IN ('post', 'page')
ORDER BY wp_posts.post_date DESC
LIMIT 0, 24
", ARRAY_A);
Or would I need to run two queries, one with count(*) for the total number of posts and then another as the above query to get the actual post content?
count(*)in your results?