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

Different styling on what's new for specific forum

Discussion in 'Styling and Customization Questions' started by Espen Espelund, Sep 12, 2011.

  1. Espen Espelund

    Espen Espelund Active Member

    We got a forum where around 50% of the posts are in a fitness journal forum. What would be the best way to style those threads differently on what's new (and possibly in the journal forum listing), like adding a css class? I'm guessing thread prefixes could be used when that comes around.

    Thread
    Thread
    Journal
    Thread
     
    Shelley and Digital Doctor like this.
  2. Trombones13

    Trombones13 Well-Known Member

    I would say that thread prefixes would be your best bet, once 1.1 is out. For now, perhaps preface each thread with the word in brackets, such as "[Journal] This is the rest of my thread title." That might be the best route to take for now.
     
  3. Digital Doctor

    Digital Doctor Well-Known Member

    Interesting idea. vaultwiki does this with vB and it works very well.
    It becomes an even more intuitive idea when it applies to other types of items such as:
    • wiki items
    • images
    • article items
    • downloads
    • blog entries
     
  4. Espen Espelund

    Espen Espelund Active Member

    Journal forum just exploded, so I need to figure out something.
     
  5. Espen Espelund

    Espen Espelund Active Member

    Code:
    <xen:if is="{$thread.forum} == 19"></xen:if>
    
    Guess something like this should be used in thread_list_item. Not working
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Edit this template:

    Admin CP -> Appearance -> Templates -> thread_list_item

    Add the red code near the top. {$showForumLink} limits the styling to the what's new page:

    Code:
    <xen:require css="discussion_list.css" />
    
    <xen:if is="{$thread.isDeleted}"><xen:include template="thread_list_item_deleted" /><xen:else />
    
    <li id="thread-{$thread.thread_id}" class="discussionListItem {$thread.discussion_state} {xen:if {$thread.sticky}, 'sticky'} {xen:if {$thread.isNew}, 'unread'} {xen:if {$showForumLink}, 'threadListNode{$thread.node_id}'}" data-author="{$thread.username}">
    
    	<div class="listBlock posterAvatar">
    		<span class="avatarContainer">
    			<xen:avatar user="$thread" size="s" img="true" />
    			<xen:if is="{$thread.user_post_count}"><xen:avatar user="$visitor" size="s" img="true" class="miniMe" title="{xen:phrase you_have_posted_x_messages_in_this_thread, 'count={xen:number $thread.user_post_count}'}" /></xen:if>
    		</span>
    	</div>
    
    Then edit this template:

    Admin CP -> Appearance -> Templates -> EXTRA.css

    Add this code to define the styles for each forum. Specify the node_id in the class names:

    Code:
    /* SET CUSTOM STYLE FOR DIFFERENT FORUMS IN WHAT'S NEW */
    /* SPECIFY NODE_ID IN CLASS NAME */
    
    .threadListNode2 .title a
    {
    	color: red;
    }
    .threadListNode5 .title a
    {
    	color: green;
    }
    
    The result:

    Screen shot 2011-09-13 at 4.30.47 PM.png
     
    rafass, Shelley, bambua and 4 others like this.
  7. Espen Espelund

    Espen Espelund Active Member

    Working perfectly. Thanks alot :)
     
  8. Digital Doctor

    Digital Doctor Well-Known Member

    Jake is the MAN !
    For educational purposes, how about a screenshot ?
     
  9. Espen Espelund

    Espen Espelund Active Member

  10. bambua

    bambua Well-Known Member

    So awesome that something like this is possible as a built in solution in the style templates, no mods required. Hats off!
     
  11. Espen Espelund

    Espen Espelund Active Member

    Yup, blown away by how easy Xen is to work with
     
  12. Blue

    Blue Well-Known Member

    I must have missed something, it's not working for me :(
    Using with double-digit node ids.

    .threadListNode49 .title a
     
  13. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It should work. Got a link to your forum so I can examine the source code?
     
  14. Blue

    Blue Well-Known Member

    PM sent

    The nodes in question are private, Moderator forums.
     
  15. Digital Doctor

    Digital Doctor Well-Known Member

  16. Espen Espelund

    Espen Espelund Active Member

    Yeah. Looked too noisy. We simply hide that forum from what's new, and use a slightly different color for them on followed threads.
     
    Digital Doctor likes this.
  17. Digital Doctor

    Digital Doctor Well-Known Member

  18. Espen Espelund

    Espen Espelund Active Member

    Digital Doctor likes this.
  19. Digital Doctor

    Digital Doctor Well-Known Member

    [​IMG]

    besides changing the color of thread titles in what's new ?
    What other styling things can be changed ?
     
  20. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It's a CSS class. You can apply any CSS.
     
    Digital Doctor likes this.

Share This Page