SubStr function
-
Hello,
I’ve a problem, I need to add the SubStr function to this part of code:$viewed_posts = get_user_meta($current_user->ID, 'nd_viewed_posts', true); if (is_array($viewed_posts) && sizeof($viewed_posts)>0) : echo '<ul class="linksin">'; $viewed_posts = array_reverse($viewed_posts); foreach ($viewed_posts as $viewed) : $viewed_post = get_post($viewed); if ($viewed_post) echo '<li><a href="'.get_permalink($viewed).'">'.$viewed_post->post_title.'</a></li>'; endforeach; echo '</ul>';
I try to add it like this:
substr($viewed_posts, 0, 5)."...";
But It doesn’t work.. why?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘SubStr function’ is closed to new replies.