I have a simple pod with a boolean called featured. I’m trying to use the find()
method (using the pods()
shortcut) to list all pod entries that have the featured boolean set to true on a page template but I can’t get it to work. I found this answer but it's for the older version and doesn't seem to work in Pods 2.0. If there’s a simpler way to do this please inform me what I’m trying something like this:
$params = array(
'orderby' => 'date DESC',
'where' => 'case_study.has_page = 1',
'limit' => -1
);
$pods = pods( 'case-study', $params );
The error I receive is:
WordPress database error: [Unknown column 'case_study.has_page' in 'where clause']
SELECT DISTINCT 't'.* FROM 'wp_posts' AS 't' LEFT JOIN 'wp_postmeta' AS 'case_study' ON 'case_study'.'meta_key' = 'case_study' AND 'case_study'.'post_id' = 't'.'id' WHERE 'case_study'.'has_page' = 1 AND 't'.'post_type' = "case_study" ORDER BY 't'.'date' DESC, 't'.'menu_order', 't'.'post_title', 't'.'post_date'
Database Error; SQL: SELECT DISTINCT 't'.* FROM 'wp_posts' AS 't' LEFT JOIN 'wp_postmeta' AS 'case_study' ON 'case_study'.'meta_key' = 'case_study' AND 'case_study'.'post_id' = 't'.'id' WHERE 'case_study'.'has_page' = 1 AND 't'.'post_type' = "case_study" ORDER BY 't'.'date' DESC, 't'.'menu_order', 't'.'post_title', 't'.'post_date'; Response: Unknown column 'case_study.has_page' in 'where clause'
It appears that it's not JOINing/WHEREing to the wp_postmeta
correctlyy but I can’t quite figure out how to use the find params to do so. It should should be 'case_study'.'meta_key'='has_page'
amongst other problems. I've tried making the field a simple relationship with a Yes/No option but still no luck.
Thank you for any help you can provide! It’s much appreciated.