Banada lazım olmustu ama wordpresin bu konuda hazır bir fonksiyonu olmaması beni cok sasırttı. Ama biraz arastırınca en uygun çözümün bu olduğunu buldum.
Aşağıdaki fonksiyonları tema dosyalarının arasındaki functions.php nin içine kaydet
if(!function_exists('postListByCategory'))
{
function categoryNameByCategoryID($categoryID = 0)
{
global $wpdb;
$sqlQuery = 'SELECT name FROM ' . $wpdb->prefix . "terms WHERE term_id=$categoryID";
return $wpdb->get_var($sqlQuery);
}
}
if(!function_exists('postListByCategory'))
{
function postListByCategoryID($categoryID = 0)
{
$outputString = '';
query_posts('orderby=date&order=DESC&cat=' . $categoryID . '');
$outputString .= '<ul>' . chr(10);
while (have_posts()) : the_post();
$permaLink = get_permalink();
$permaLink = trim($permaLink);
if(!empty($permaLink))
{
$outputString .= '<li>' . chr(10);
$outputString .= '<a href="' . get_permalink() . '">' . get_the_title($post->ID) . '</a>' . chr(10);
//$outputString .= '<small>' . get_the_time('D M jS Y') .'</small>' . chr(10);
$outputString .= '</li>' . chr(10);
}
endwhile;
$outputString .= '</ul>' . chr(10);
return $outputString;
}
}
Daha sonra kategoriye ait konuları listelemek için postListByCategoryID() fonksiyonunun içine kategori id sini yazarak temanın içinde kullanabilirsin.