Monday, October 3, 2022
HomeWordPress Developmentcustomized area - Web site makes use of wpdb to fetch meta_keys...

customized area – Web site makes use of wpdb to fetch meta_keys however simply shows first meta_key from a web page (the submit makes use of the identical meta_key “filmmaker” greater than as soon as)


My web page ought to show all filmmakers, which were tagged as “filmmaker” in my posts. I do have posts that function multiple filmmaker (meta_key = filmmaker) in customized fields, however solely the primary one seems within the “overview” that I need to show. The opposite two appear to be ignored. What do I do flawed? (or my predecessor, as a result of I took over this web page). Thanks one million.

That is my Code (picture of submit connected)

<desk class="movies">
<?php

$letter="";

foreach($wpdb->get_col("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = 'filmmaker' ORDER BY meta_value") as $identify):
    $title = cnext_letterheading($identify);
    if($title && ($title != $letter)) {
        $letter = $title;
        echo '<tr><td><h3>', $letter, '</h3></td></tr>';
    }
?>

<tr class="submit movie film-line">
    <td class="title">
        <a href="<?php echo get_site_url(); ?>/?filmmaker=<?= urlencode($identify) ?>">
            <h2 class="entry-title"><?= htmlspecialchars($identify) ?></h2>
        </a>
    </td>
</tr><!-- #post-## -->


<?php endforeach ?>
</desk>

enter image description here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments