My page should display all filmmakers, that have been tagged as "filmmaker" in my posts. I do have posts that feature more than one filmmaker (meta_key = filmmaker) in custom fields, but only the first one appears in the "overview" that I want to display. The other two seem to be ignored. What do I do wrong? (or my predecessor, because I took over this page). Thanks a million.
This is my Code (image of post attached)
<table class="films">
<?php
$letter = '';
foreach($wpdb->get_col("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'filmmaker' ORDER BY meta_value") as $name):
$title = cnext_letterheading($name);
if($title && ($title != $letter)) {
$letter = $title;
echo '<tr><td><h3>', $letter, '</h3></td></tr>';
}
?>
<tr class="post film film-line">
<td class="title">
<a href="<?php echo get_site_url(); ?>/?filmmaker=<?= urlencode($name) ?>">
<h2 class="entry-title"><?= htmlspecialchars($name) ?></h2>
</a>
</td>
</tr><!-- #post-## -->
<?php endforeach ?>
</table>