1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum is for release discussion only. Discussions that do not relate specifically to the resource release should be discussed in another, more appropriate forum.
    Dismiss Notice
  3. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Add "Latest Threads" To Navbar

Discussion in 'Template Modifications [Archive]' started by Jake Bunce, Nov 27, 2010.

  1. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This will add a "Latest Threads" link to the navbar which shows a list of all threads from the last 30 days, unread or not. It looks like this:

    Screen shot 2010-11-27 at 11.08.49 AM.png

    Edit this template:

    Admin CP -> Appearance -> Templates -> navigation

    Add this code:

    						<li><a href="{xen:link 'find-new/threads', '', 'days=30'}">Latest Threads</a></li>
    ...as shown below:

    		<!-- forums -->
    		<xen:if is="{$tabs.forums}">
    			<li class="navTab forums {xen:if $tabs.forums.selected, 'selected', 'Popup PopupControl PopupClosed'}">
    				<a href="{$tabs.forums.href}" class="navLink">{$tabs.forums.title}</a>
    				<a href="{$tabs.forums.href}" class="SplitCtrl" rel="Menu"></a>
    				<div class="{xen:if {$tabs.forums.selected}, 'tabLinks', 'Menu JsOnly tabMenu'}">
    					<div class="primaryContent menuHeader">
    						<div class="muted">{xen:phrase quick_links}</div>
    					<ul class="secondaryContent blockLinksList">
    						<xen:if is="{$visitor.user_id}"><li><a href="{xen:link 'forums/-/mark-read', '', 'date={$serverTime}'}" class="OverlayTrigger">{xen:phrase mark_all_forums_read}</a></li></xen:if>
    						<xen:if is="{$canSearch}"><li><a href="{xen:link search, '', 'type=post'}">{xen:phrase search_forums}</a></li></xen:if>
    						<xen:if is="{$visitor.user_id}"><li><a href="{xen:link 'watched/threads'}">{xen:phrase watched_threads}</a></li></xen:if>
    						<li><a href="{xen:link 'find-new/threads'}">{xen:phrase whats_new}</a></li>
    						<li><a href="{xen:link 'find-new/threads', '', 'days=30'}">Latest Threads</a></li>
    You can see the link is set to show the last 30 days of threads. You can change the number of days if you want.

    The "Latest Threads" text is hard coded. You can put that into a phrase if your forum supports multiple languages. Otherwise it doesn't matter.
    Afra, clmazin, ARSamo and 13 others like this.
  2. cobra1162

    cobra1162 Active Member

  3. Jamie

    Jamie Well-Known Member

    Hey Jake thanks for this guide, but I have a question.

    Is it possible to create the secondary menu as a selectable drop down list?

    For example, I would like to extend your Latest Threads to include a selectable drop down with several options for viewing threads.

    What's New
    New in last 24 hours
    New in last 48 hours

    I could make a link, changing the time frame for each of these, but how do I get them in a drop down list in the secondary menu? Is something like this possible?

    Mock up of what I am talking about:

    pipedreams likes this.
  4. Russ

    Russ Well-Known Member

    Should be plausible with some edits, custom code each element of the dropdown with the:

    {xen:link 'find-new/threads', '', 'days=30'}
    I'm at work now so I'm limited what I can do but when I get home if Jake hasn't beaten me to the punch like usual I'll see what I can do haha.
    pipedreams likes this.
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    My kung fu is bad at menus. Go for it Russ. :p

    In my opinion the expanded menu is unnecessary for this. It's enough to have just one link that shows a full 30 days. The search results are sorted by last post date so the user can already see, for example, posts from the last 24 hours inside of the 30 day listing.
    Russ likes this.
  6. Jamie

    Jamie Well-Known Member

    Ah, true. I hadn't though of that. I see your point.

  7. Jamie

    Jamie Well-Known Member

    hey Jake and Russ,

    I have placed the link in my secondary menu like Jake explained and this works, but I wonder if this could be extended some.

    When a member clicks the What's new link, if there are no new posts, it shows this:


    I would like to change this so if a member clicks the What's new link and there are no new posts, then it would tell them there is no new posts, but then display the latest threads instead.

    Here is a mock up of what I am asking for:


    Is something like this possible? Is there an If/Then statement that if the results were null/empty then show latest threads?

    erich37 and mochito like this.
  8. Dean

    Dean Well-Known Member

    In case someone is not aware, there is a All Recent Messages button now from the 'whats new' view. Click on Whats New, then towards the right there is a All Recent Messages button...

    erich37 likes this.
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That link only shows after clicking What's New, and only if there are threads shown on the What's New page.
  10. Dean

    Dean Well-Known Member

    Both true.

    Ideally that button/link would still be there is there was no new threads. Think I should make a suggestion...
  11. shenmuee

    shenmuee Active Member

    thanks i like it =)
  12. clawsonr

    clawsonr Member

    Awesome, Thank you!
  13. Dean

    Dean Well-Known Member

    FYI - I tested V1.03, and on my test site when I clicked on whats new, the "You may view all recent threads instead." link shows up. (y)
  14. erich37

    erich37 Well-Known Member


    so "Latest Threads" is the same as "All Recent Messages" ?
  15. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    erich37 likes this.
  16. jcm

    jcm Member

    Thanks for the tip. It would be great to have this as a selectable setting or some kind of navigation customization tool for a future release.
    erich37 likes this.
  17. DRE

    DRE Well-Known Member

    Check this out: http://xenforo.com/community/thread...op-down-rss-feeds-like-firefox-toolbar.25377/

    Navigation Menu With Drop-Down RSS Feeds Like Firefox Toolbar


Share This Page