GET the excerpt by ID

Question

Why is it that one cannot get the excerpt by ID like with the title and most other elements.

eg. get_the_excerpt(ID). I know how to use it with the $post->post_excerpt function but that does not return part of the content if no excerpt was entered it simple returns nothing.

So what I am trying to do is get the excerpt by ID if there is an excerpt, and if there isn’t an excerpt with that ID but there is some content, to get some of the content instead.

How would one do that.

Any ideas,

Marvellous …

EDIT —

Loop Source Code as Requested.

<?php $stories = get_posts('category_name=feedback&numberposts=4'); 
            foreach ($stories as $post) :
            $title = $post->post_title;
            $excerpt = get_the_excerpt_id($post->ID);
            $thumb = get_the_post_thumbnail($post->ID,array(60, 60, true));?>
              <div class="textstandard_white" style="font-size:14px; line-height:22px; padding-top:10px;"><b><a href="<?php echo get_permalink($post->ID);?>"><?php echo $title;?></a></b></div><div align="left" style="height:18px; width:82px; background:url(http://www.divethegap.com/update/z-images/structure/icons/stars.png) left top no-repeat;"><div id="stars<?php echo $post->ID;?>" align="left" style="height:18px; background:url(http://www.divethegap.com/update/z-images/structure/icons/stars_glow.png) left top no-repeat;">
                  </div>
                  </div>

                  <script type="text/javascript">
                var width<?php echo $post->ID;?> = ((<?php
$Rating = get_post_meta($post->ID, "Rating", true);
echo $Rating;
?> * 20) + '%')
                  $('#stars<?php echo $post->ID;?>').css('width', width<?php echo $post->ID;?>);

                 </script><div class="textstandard_white" style="padding-top:6px; font-size:10px; color:#BBB; padding-bottom:10px; border-bottom:1px dotted #BBB; min-height:70px;"><div style="float:left; padding-right:6px; padding-bottom:6px;"><div style="background:#FFF; border:1px solid #FFF;
border-radius: 4px; -moz-border-radius: 4px ; -webkit-border-radius: 4px; padding:4px;"><a href="<?php echo get_permalink($post->ID);?>"><?php echo $thumb;?></a></div></div>



<?php echo $excerpt;?></div>
              <?php endforeach;?>
0
Robin I Knight 4 days 0 Answers 3 views 0

Leave an answer