Hi,
I'm using below code for triming titles and show it recent posts section on my blog:
<?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>';
} ?>
But there are problem with HTML character entities. When i use substr
function for trim a title, substr
function trimming HTML character entities too.
So i tried to use html_entity_decode
function but i can't do it very well.
Anyone can help me?