ÇÖZÜMÜ
argon adlı üyeden alıntı:
mesajı görüntüle
7
●131
function latest_post() {
$args = array(
'posts_per_page' => 1,
'tag' => 'etiket' );
$str = "";
$posts = get_posts($args);
foreach($posts as $post):
$str = $str."<h2>". apply_filters( 'the_title', $post->post_title) ."</h2>";
endforeach;
return $str;
} function latest_post() {
$args = array(
'posts_per_page' => 1, // we need only the latest post, so get that post only
'tag' => 'haftalik-burc-yorumlari' // Use the category id, can also replace with category_name which uses category slug
);
$yaz = "";
$bloglar = get_posts($args);
foreach($bloglar as $tekli):
$yaz = $yaz."<a href=\"".get_permalink($tekli)."\">". apply_filters( 'the_title', $tekli->post_title) ."</a>";
endforeach;
return $yaz;
}
add_shortcode('latest_post', 'latest_post');