How to display limit text (code)?
-
Hi
i’m trying to use this function in my theme to display 5 related posts in single.php
and it’s work good! but i need to add something to make it display limit text from the first of each post.function my_related_posts() { if (is_single()) { global $post; $current_post = $post->ID; $categories = get_the_category(); foreach ($categories as $category) : ?> <div class="content-loop"> <h4>Related Posts</h4> <ul> <?php $posts = get_posts('numberposts=5&category='. $category->term_id . '&exclude=' . $current_post); foreach($posts as $post) : ?> <li class="hentry"> <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail('entry-thumb', array('class' => 'entry-thumb','alt' => get_the_title(),'title' => get_the_title())); ?></a> <h2 ><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <div class="entry-excerpt"> <?php /* here i want function get limit text from first of content*/ ?> <a href="<?php the_permalink(); ?>" class="read-more">read more...</a> </div> </li> <?php endforeach; ?><?php endforeach; ?> </ul> </div> <?php } wp_reset_query(); } add_action('thesis_hook_after_post','my_related_posts');
please help
thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to display limit text (code)?’ is closed to new replies.