Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

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"
);
share|improve this question
1  
Please take a look at like_escape() and meta-query. –  kaiser Apr 26 '13 at 11:35
    
Please post all of the relevant code. As is, I can't see why you need a custom SQL query at all. –  s_ha_dum Apr 26 '13 at 13:09
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.