Need help with a mini-loop and categories….
-
I am trying to list recent posts in a single category on a couple of static php pages on my site.
Linked below is the 1st page I am working on. The list appears under “Recent Georgia Bulldogs Basketball Articles.”
https://www.sicemdawgs.com/basketball/bk.php
I want to list only posts in the category Basketball. Can someone help me modify the code to display only this category? Code is pasted below (I got it from www.ads-software.com):
<?php $how_many=5; //How many posts do you want to show require_once('../blog/wp-config.php'); // Change this for your path to wp-config.php file ?> <ul class="blinks"> <? $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many"); foreach($news as $np){ printf ("<li><a href=\"%s\">%s</a></li>", get_permalink($np->ID),$np->post_title); } ?> </ul>
[moderated–bump removed. Please refrain from bumping as per Forum Rules]
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Need help with a mini-loop and categories….’ is closed to new replies.