XF 2.3 How to add a "Back to Topics" button at the bottom of threads..

zzlpolitics

Active member
Users are overwhelmingly requesting that I add a way for them to get back to the main forum in lieu of getting rid of the breadcrumbs because I only have one page and so they were just more confusing to my aging users. Is there any way to just plop a button at the bottom of pages so users could simply click it and go back to the main forum page? They've figured out they can scroll to the top and click the logo but that's of course a lot to ask of people!

Thanks in advance for any help!
 
Solution
HTML:
<div style="margin:10px auto; width:max-content">
    <xf:button href="{{ link('index') }}" class="button button-cta" style="background-color: orange; color: black; border-color: green">Back to the Forum</xf:button>
</div>

This should always product a link to your index page (whatever that is).

But as said before, modifying HTML is probably not smth. beginners should do and using inline CSS is a bad practice that should be avoided (as far as possible).
Thanks for the suggestion. That is an idea but the problem with my forum is that, for now, it is just one forum. Like, I would be fine with it just being one page (the main topic list) and that's it. If you click that button, you get this:

Screenshot 2024-07-24 173008.webp

I don't even need a Forum list page or the button itself to say "Forums" as it's just one forum.

If you or anyone reading this has any thoughts about how I could simplify everything like I'm suggesting, I'd appreciate any help!
 
You can change the index page route as you like.

Go to
https://yourforum.com/admin.php?options/indexRoute/view
and change that to the URL of your forum (most likely that would be forums/main-forum.2/)
 
Last edited:
If you don't mind editing templates:

Depending on what type of thread you use edit these templates (the most common is thread_view:


btn.webp

Look for <xf:ad position="thread_view_below_messages" arg-thread="{$thread}" />

Place this code above (change link & style as needed): <xf:button href="/YOUR_FORUM" class="button button-cta" style="background-color: orange; color: black; border-color: green">Back to the Forum</xf:button>

btn1.webp
 
You can change the index page route as you like.

Go to
https://yourforum.com/admin.php?options/indexRoute/view
and change that to the URL of your forum (most likely that would be forums/main-forum.2/)
Thanks! I'd actually already done this so if you go to my forum URL, you go straight to the main page but it's when you start clicking around that you get taken to the forum list page of which I don't need.
 
<xf:button href="/YOUR_FORUM" class="button button-cta" style="background-color: orange; color: black; border-color: green">Back to the Forum</xf:button>
Amazing! Thanks so much. This is a great fix that I can see will work if I can figure out two things. I uhh don't know what I should be linking for your forum as if I try a few things the URL is basically my whole forum plus the thread in the URL. https://zzlpolitics.com/forums/main-forum.2/ is the direct link to the page I want but if I replace /YOUR_FORUM with basically anything, I just manage to break it. What should I put there if you know?

Also, any idea on how to center the button? Way less important than that is to bump it off the comment box so they're not directly touching. That's nitpick level though.

Thanks a million, you're a lifesaver!
 
HTML:
<div style="margin:10px auto; width:max-content">
    <xf:button href="{{ link('index') }}" class="button button-cta" style="background-color: orange; color: black; border-color: green">Back to the Forum</xf:button>
</div>

This should always product a link to your index page (whatever that is).

But as said before, modifying HTML is probably not smth. beginners should do and using inline CSS is a bad practice that should be avoided (as far as possible).
 
Solution
<div style="margin:10px auto; width:max-content"> <xf:button href="{{ link('index') }}" class="button button-cta" style="background-color: orange; color: black; border-color: green">Back to the Forum</xf:button> </div>
season 4 you are the man GIF by Billions


Dude, that worked PERFECT. It looks absolutely great. People are thrilled. I can't thank you enough.
 
How do you do it a different colour for alternate (dark mode)
 
Back
Top Bottom