Select Where condition from a relationship field
-
Hi
Another of my nightmares as I have spent time trying to get this to work.I have a Baptism Pod and a Clergy Pod. I have a field called Related_Clergy in the Baptism Pod and a field in the Clergy Pod called Related_Baptism.
They are hopefully set up right as a relation between each other. I would like to add all the Baptisms onto each of the Clergy’s pages.
On the Clergy’s single template page, I have set the Pod up for Baptism and I need a Where clause to filter by each Clergy i.e. Robert Williams.
I have used this code and can’t get it to work:
$clergy_name = get_the_title(); $pods = pods( 'baptism', get_the_id() ); $params = [ 'limit' => 10, 'orderby' => 'baptism_number ASC', 'where' => 'clergies_name = "' . pods_sanitize( $clergy_name ) . '"', ]; $pods->find( $params );
All I keep getting is unknown column, no matter how I try nothing works.
- related_clergy
- related_clergy.post_title
Please point me into the right direction.
Morris
- The topic ‘Select Where condition from a relationship field’ is closed to new replies.