1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Outputting number of replies/posts & likes in the first post of every thread

Discussion in 'Styling and Customization Questions' started by Ray, Jul 5, 2011.

  1. Ray

    Ray Active Member

    I would like to display the number of replies/posts each thread has along with the number of LIKES the first post has, see screenshot:

    sshot.png

    Thanks in advance :)
     
    EQnoble likes this.
  2. EQnoble

    EQnoble Well-Known Member

    I would also be interested to know how that could be done, to anyone that might take the time to explain it.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> thread_view

    Add this code:

    Code:
    <div>
    	<span class="highlight">Replies</span>: {$thread.reply_count} <span class="highlight" style="margin-left: 20px;">Likes</span>: {$thread.first_post_likes}
    </div>
    
    Like so:

    Code:
    <xen:container var="$head.canonical">
    	<link rel="canonical" href="{xen:link 'canonical:threads', $thread, 'page={$page}'}" /></xen:container>
    <xen:container var="$head.description">
    	<meta name="description" content="{xen:helper snippet, $firstPost.message, 155}" /></xen:container>
    <xen:container var="$head.openGraph"><xen:include template="open_graph_meta">
    		<xen:set var="$url">{xen:link 'canonical:threads', $thread}</xen:set>
    		<xen:set var="$title">{$thread.title}</xen:set>
    		<xen:set var="$avatar">{xen:helper avatar, $thread, m, 0, 1}</xen:set>
    	</xen:include></xen:container>
    
    <div>
    	<span class="highlight">Replies</span>: {$thread.reply_count} <span class="highlight" style="margin-left: 20px;">Likes</span>: {$thread.first_post_likes}
    </div>
    
    <xen:if is="{$canReply}">
    	<xen:comment><xen:topctrl>
    		<a href="{xen:link 'threads/reply', $thread}" class="callToAction"><span>{xen:phrase reply_to_thread}</span></a>
    	</xen:topctrl></xen:comment>
    </xen:if>
    
    The result:

    Screen shot 2011-07-05 at 9.59.12 AM.png
     
    EQnoble and Ray like this.
  4. Ray

    Ray Active Member

    Thank you very much, Jake! You're the man :)
     
    EQnoble likes this.
  5. EQnoble

    EQnoble Well-Known Member

    Ditto :)
     

Share This Page