Are you talking about everything from
if ($postids) {….
down in that example or the whole thing? Is there a way I can set up post data without changing the query line?
Sorry, for the questions, its probably right in front of me….my brain is rebelling this morning.
you could try to use ‘setup_postdata()’:
foreach($rows as $row){
setup_postdata($row);
echo "the id post id: " . $row->post_id;
echo "";
echo $row->post_title;
}
Hmm. That doesn’t echo the post_title. It still only echos the post ID only.
I was also trying something like this, from the general query example, but it comes out blank:
<?php
$query = "SELECT * FROM $wpdb->postmeta WHERE meta_key = 'grade-type' AND meta_value like '%Post Secondary%'";
$rows = $wpdb->get_results($query);
if ($rows) :
foreach ($rows as $post) :
setup_postdata($post);?>
<h2><a href="<?php the_permalink(); ?>" rel="bookmark"
title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php
endforeach;
else :
?>
<h2> Not Found</h2>
<?php endif; ?>
ok trying this:
<?php
$querystr = "SELECT *
FROM $wpdb->postmeta, $wpdb->posts
WHERE meta_key = 'grade-type'
AND meta_value like '%Post Secondary%'
ORDER BY wposts.post_date DESC
";
$pageposts = $wpdb->get_results($querystr, OBJECT);
?>
<?php if ($pageposts): ?>
<?php foreach ($pageposts as $post): ?>
<?php setup_postdata($post); ?>
<h4><?php the_title(); ?></h4>
<?php endforeach; ?>
<?php else : ?>
<h2 class="center">There seems to be a glitch here.</h2>
<?php endif; ?>
I am not a programmer, but I am trying. Any suggestions? I am not sure about the above link’s example about joining.
thanks
Nadine