Re: Display excerpt of first and last post in front-page.php :: Reply by Joern

von Joern am 16. Okt. 2010 | Keine Kommentare

That was easier than expected!

I used the condition:

if ($post->post_id != $topic->topic_last_post_id )

to display the excerpt of the answer only if is not the question itself

The working code looks now like this:


<p class="quest">
<?php $post = bb_get_first_post(get_topic_id());
echo make_excerpt(get_post_text($post->post_id)); ?>
<?php if ($post->post_id != $topic->topic_last_post_id ) { ?>
<p class="ans">
<?php echo make_excerpt( get_post_text( $topic->topic_last_post_id ) ); ?>
<?php } ?>

Sure have to post this ‚answer‘ now to see if it is working..


now have to set this condition also in the two other templates where I use a similar display, this is in my theme the forum.php as well as the tag-single.php
you find me on Google+, Twitter and Facebook

(von: Joern)

Hier noch 1 weitere Ergebnisse dieses Threads:

Display excerpt of first and last post in front-page.php

16. Okt. 2010 (von: Joern)

As you can see I am displaying the first posts excerpt here in this bbPress forum by runningmake_excerpt(get_post_text($post->post_id));and the last answers excerpt by usingmake_excerpt( get_post_text( $topic->topic_last_post_id ) );The problem arising is that with only one post it will display the…


Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

weitere forum Beiträge: