Get categories
-
I have the following code on a custom page template to retreive particular posts. I can’t seem to figure out what to add to this so that I can also get posts of a particular category. Any help would be appreciated. Thanks.
<?php $querystr = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wposts.post_status = 'publish' AND wposts.post_type = 'post' AND wpostmeta.meta_key = 'sidedate' AND wpostmeta.meta_value > NOW() ORDER BY wpostmeta.meta_value desc "; $pageposts = $wpdb->get_results($querystr, OBJECT); ?> <?php if ($pageposts): ?> <?php foreach ($pageposts as $post): ?> <?php setup_postdata($post_title); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> <?php endif; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Get categories’ is closed to new replies.