I warn you now I'm new to php ! What I would like to do is limit the title outputted by . get_the_title() . to say 30 characters
I have this in my theme:
I have added a function to my theme to replace 'the_title' to display shorter titles elsewhere but if I try to use this function in the above code eg. change 'get_the_title' to my 'trim_title' function all goes pear shaped.Code:<ul> <?php if (is_single()) { $posts = get_posts('numberposts=5&orderby=post_date'); } else { $posts = get_posts('numberposts=5&orderby=rand'); } foreach($posts as $post) { setup_postdata($post); echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>'; } $post = $posts[0]; ?> </ul>
Any help would be really appreciated
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks