Son gönderileri listelemeye yarayan ve shortcode aracılığıyla yazı içinde kullanılabilmesini sağlayan wordpress kodu alternatifidir.
function SonGonderileriListele() {
$recent_posts = wp_get_recent_posts(array(
'numberposts' => 10, // Number of recent posts thumbnails to display
'post_status' => 'publish' // Show only the published posts
));
$liste = "";
foreach($recent_posts as $post) {
$liste = $liste .
'<li>' .
'<a class="bgl" href="' . get_permalink($post['ID']) . '?>">'
. $post['post_title']
. '</a>'
. '</li>';
}
wp_reset_query();
return $liste;
}
add_shortcode('SonGonderiler', 'SonGonderileriListele');