Arayan get_the_title()ve çalışan bir kodum var ama get_the_excerpt()boş dönüyorum. Nasıl çalıştırabilirim?
Bu kod "WP Facebook Open Graph protokolü" adlı bir eklentinin içindedir. İşte değiştirmek istediğim kısım:
if (is_singular('post')) {
if (has_excerpt($post->ID)) {
echo "\t<meta property='og:description' content='".esc_attr(strip_tags(get_the_excerpt($post->ID)))."' />\n";
}else{
echo "\t<meta property='og:description' content='". [?] ."' />\n";
}
}else{
echo "\t<meta property='og:description' content='".get_bloginfo('description')."' />\n";
}
Burada, has_excerpther zaman başarısız olur ve get_the_excerpt($post->ID)artık çalışmaz (kullanımdan kaldırıldı).
Öyleyse, burada alıntıyı nasıl gösterebilirim?
ps: "Advanced Excerpt" eklentisini de kullanıyorum
the_post()(tek mesaj şablonunda da çalışır) işlevini kullanmadan önce sizin get_the_excerpt()için gerekli verileri ayarlayacaktır.
my_excerpt($post->post_content, get_the_excerpt())ve kullanmamy_excerpt()işlevini wordpress.stackexchange.com/questions/6961/...