我正在使用下面的代码来修剪标题并在我的博客上显示最近的帖子部分:
<?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
功能,但我不能很好地做到这一点。
任何人都可以帮助我吗?