go41

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:

Code:

<p class="quest">
<?php $post = bb_get_first_post(get_topic_id());
echo make_excerpt(get_post_text($post->post_id)); ?>
</p>
<?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 ) ); ?>
</p>
<?php } ?>

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

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…

Autor:

Du findest mich auch auf Google+, Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


weitere forum Beiträge: