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

How to Add a New Section In The Sidebar?

Discussion in 'Styling and Customization Questions' started by Kay, Aug 5, 2012.

  1. Kay

    Kay Member

    Hello,

    I've noticed on some Xenforo sites, there are added rectangular sections on the right side - normally under the forum statics box. Some may say "site of the month" or "advertise here" etc. How do you add these sections/boxes?

    Thanks in advance.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. Kay

    Kay Member

    Hi Jake, thanks for the quick response. I'm not really sure how the google custom search will add the two sections I am referring to. I will show some images for what I was referring to just to clarify. If you could let me know in a little more detail how I can accomplish this, it would be appreciated. Thanks.
     

    Attached Files:

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The Google search is just the content of the block in that example. More generally:

    Admin CP -> Appearance -> Templates -> forum_list

    Add the red code:

    Code:
    <xen:h1>{$xenOptions.boardTitle}</xen:h1>
    
    <xen:container var="$head.canonical"><link rel="canonical" href="{xen:link 'canonical:index'}" /></xen:container>
    <xen:if is="{$xenOptions.boardDescription}"><xen:container var="$head.description">
    	<meta name="description" content="{$xenOptions.boardDescription}" /></xen:container></xen:if>
    <xen:container var="$head.openGraph">
    	<xen:include template="open_graph_meta">
    		<xen:set var="$url">{xen:link 'canonical:index'}</xen:set>
    		<xen:set var="$title">{$xenOptions.boardTitle}</xen:set>
    	</xen:include></xen:container>
    
    <xen:hook name="forum_list_nodes">
    	<xen:if is="{$renderedNodes}"><xen:include template="node_list" /></xen:if>
    </xen:hook>
    	
    <xen:sidebar>
    	<xen:edithint template="sidebar.css" />
    
    	<div class="section">
    		<div class="secondaryContent">
    			YOUR CONTENT HERE
    		</div>
    	</div>
    
    	<xen:hook name="forum_list_sidebar">
    		<xen:include template="sidebar_online_users" />
    		
    		<!-- block: forum_stats -->
    		<div class="section">
    			<div class="secondaryContent statsList" id="boardStats">
    				<h3>{xen:phrase forum_statistics}</h3>
    				<div class="pairsJustified">
    					<dl class="discussionCount"><dt>{xen:phrase discussions}:</dt>
    						<dd>{xen:number $boardTotals.discussions}</dd></dl>
    					<dl class="messageCount"><dt>{xen:phrase messages}:</dt>
    						<dd>{xen:number $boardTotals.messages}</dd></dl>
    					<dl class="memberCount"><dt>{xen:phrase members_count}:</dt>
    						<dd>{xen:number $boardTotals.users}</dd></dl>
    					<dl><dt>{xen:phrase latest_member}:</dt>
    						<dd><xen:username user="$boardTotals.latestUser" /></dd></dl>
    					<!-- slot: forum_stats_extra -->
    				</div>
    			</div>
    		</div>
    		<!-- end block: forum_stats -->
    		
    		<xen:include template="sidebar_share_page">
    			<xen:set var="$url">{xen:link canonical:index}</xen:set>
    		</xen:include>
    		
    	</xen:hook>
    </xen:sidebar>
    
     
  5. Kay

    Kay Member

    Ok, thanks Jake
     
  6. borbole

    borbole Well-Known Member

    If you want to add unlimited custom sidebar blocks with ease without manual template edits have a look at my mod here:

    http://xenforo.com/community/resources/add-create-unlimited-custom-sidebars.894/
     
  7. Kay

    Kay Member

    Thanks Borbole. You always seem to have an answer for my questions :) I tried going on to your forum to see a demo of this add on but could not access the forum. Btw, any update for the "hide media and attachment link" add on?
     
    borbole likes this.
  8. borbole

    borbole Well-Known Member

    I had been away for the last couple of days. Now the forum is open again.

    I will have a look at it as soon as I finish a couple of paid mods that I am currently working on.
     
  9. Kay

    Kay Member

    I understand, ok thanks
     

Share This Page