以下のコードを使用してタイトルをトリミングし、ブログの最近の投稿セクションを表示しています。
<?php global $post;
$releaseDate = get_post_meta($post->ID, "gosterim_tarihi", true);
foreach( $images as $image ) {
$title = get_the_title();
if (strlen($title) > 20) { $title = substr($title, 0, 20) . '…'; }
$attachmentimage=wp_get_attachment_image_src( $image->ID, 'large' );
echo '<li><a href="'. get_permalink() .'" title="' . $title . '"><img src="'. $attachmentimage[0] .'" alt="'. $title .'" />'. $title .'<span>Gösterim Tarihi: ' . $releaseDate . '</span></a></li>';
} ?>
しかし、HTML 文字エンティティには問題があります。substr
タイトルをトリミングする関数を使用すると、 substr
HTML 文字エンティティもトリミングされます。
だから私は関数を使おうとしましhtml_entity_decode
たが、うまくできません。
誰でも私を助けることができますか?