MyBB Community Forums

Full Version: Display the first message of a thread differently
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there,
Title says it all; I was wondering if there is a way to Display the first message of a thread differently than the other posts in the same thread ?

Thanks.
in general, a plugin is required to distinguish first post from the other posts & add required styles for the post.

plugin like template conditionals or XThreads can be used for such requirement.
Thanks for the reply .m.
May I ask you to lead me towards the realization of it ? I know it may seem unpolite to simply ask for the solution, but my knowledges in this are way too limited for me to find out by myself, even though I do already have Template conditionals. :l
basically postbit style needs to be changed for the first post

though there can be better methods,
logic can be like below for the postbit template

original code from postbit template
<div class="post_body scaleimages" id="pid_{$post['pid']}">
{$post['message']}
</div>

with template conditionals plugin,
for the first post we can change the class for the above code like below
Quote:<if $thread['replyto'] == 0 then>
<if $postcounter == 1 then>
<div class="firstpost_body scaleimages" id="pid_{$post['pid']}">
<else>
<div class="post_body scaleimages" id="pid_{$post['pid']}">
</if>
{$post['message']}
</div>

newly used class firstpost_body should be defined with required style properties
(in global.css or showthread.css of the theme)

(edited)
Thank you for your time and reply.
Unfortunately, the firstpost_body class seems to apply even beyond the first post. :l
oh! please change the condition <if $thread['replyto'] == 0 then> to <if $postcounter == 1 then> & check
Thank you very much .m., marked and repped. ♥
EDIT: Any idea why "{$post['thanked_count']}" is working only in the first post ? I tried to edit by doing the following instead:


<if $postcounter == 1 then>
<div class="first_post post {$unapproved_shade}" style="{$post_visibility}" id="post_{$post['pid']}">
<else>
<div class="post {$unapproved_shade}" style="{$post_visibility}" id="post_{$post['pid']}">
</if>
Solved by updating the plugin. Thanks again.