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

XF 1.2 Add class to threads over a certain amount of replies

Discussion in 'Styling and Customization Questions' started by Case, Dec 31, 2013.

  1. Case

    Case Active Member

    Hi

    When viewing a forum, I'd like to add a class to the thread list item if that thread has over x amount of replies.

    eg.

    <li id="thread-1" class="discussionListItem visible extraClass" data-author="User">

    Is this possible?

    Thanks
     
  2. katsulynx

    katsulynx Well-Known Member

    I'd say it is possible by using the Xenforo Conditional Statements and the Template Modification System through setting the Forum to debug mode.

    You need to do the following:
    1. Set the forum to debug mode
    2. Search the Template that contains your part of information
    3. Open the TMS, add the appropriate statement and close
    4. You're done
     
    Case likes this.
  3. Case

    Case Active Member

    Thanks for the reply. I couldn't see a statement that refers to number of replies though. Any idea?
     
  4. katsulynx

    katsulynx Well-Known Member

    You will need to use a simple comparrison variable<-> numeric value. You will find the appropriate value near the spot where you want to add your statement.

    I'm short on time at the moment, but maybe I can have a look for you later.
     
    Case likes this.
  5. Dan

    Dan Well-Known Member

    Code:
    {xen:if "{$thread.reply_count} > 4", 'myclass'}
    
     
    Steve F, Manoj_Kumar and Case like this.
  6. Jeremy

    Jeremy XenForo Moderator Staff Member

    You can edit the template directly, it is the recommended method.
     

Share This Page