Home › Forums › Front-end Issues › Select field filter not working › Reply To: Select field filter not working
Hi Elliot,
Thanks for your response.
I’ve tried it like this ;
<?php echo get_sub_field('adres_lid', $row->post_id); ?>
But it returns empty. Or isn’t it possible to show a subfield like that?
This is the whole code now
<?php
// get all rows from the postmeta table where the sub_field (type) equals 'type_3'
// - http://codex.wordpress.org/Class_Reference/wpdb#SELECT_Generic_Results
$rows = $wpdb->get_results($wpdb->prepare(
"
SELECT *
FROM wp_postmeta
WHERE meta_key LIKE %s
AND meta_value = %s
",
'leden_details_%_plaats_lid', // meta_name: $ParentName_$RowNumber_$ChildName
'gytsjerk' // meta_value: 'type_3' for example
));
// loop through the results
if( $rows )
{
foreach( $rows as $row )
{
?>
<li class="leden-details"><?php echo get_the_title( $row->post_id ); ?></li>
<li class="leden-show"><?php echo get_sub_field('adres_lid', $row->post_id); ?></li>
<?php
}
}
?>
Thanks
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 9, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.