get_query_var(‘paged’) giving same result

I have a custom page, in that page i am using a custom select query for my search functionality.

The problem is pagination not working. I used $on_page= get_query_var('paged'); for pagination. When I echo $on_page, it always return 0 as the result. I am using a custom theme (soundwaves) for my site.

Read More

This is my query:

$resultsTotal = $wpdb->get_results(
    "SELECT p.post_title,p.ID,pm.meta_value 
        FROM wp_posts p 
        join wp_postmeta pm ON p.ID=pm.post_id 
        WHERE  pm.meta_value 
                LIKE '%$track%' AND (p.post_type='post' AND p.post_status='publish')  
        GROUP BY p.ID"
);

Related posts

Leave a Reply