Thread Starter
FinDes
(@findes)
Here is what I have so far, but there is something wrong with my query…
<?php
echo("<ul>");
$ID = get_the_ID();
echo("<li>ID = " . $ID . "</li>");
$title = get_post_custom_values('Title', $ID);
$season = get_post_custom_values('Season', $ID);
echo("<li>Title = " . $title[0] . "</li>");
echo("<li>Season = " . $season[0] . "</li>");
echo("</ul>");
$querystr = "
SELECT wposts.*
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = $title[0]
AND wpostmeta.meta_key = $season[0]
AND wposts.post_status = 'publish'
AND wposts.post_type = 'post'
ORDER BY wposts.post_date DESC
";
$pageposts = $wpdb->get_results($querystr, OBJECT);
?>
<ul>
<?php if ($pageposts): ?>
<?php foreach ($pageposts as $post): ?>
<?php setup_postdata($post); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a></li>
<?php endforeach; ?>
<?php else : ?>
<li>Sorry no other episodes this season, yet.</li>
<?php endif; ?>
</ul>