XF 2.3 How can I put the Post Thread button here?

beerForo

Well-known member
Licensed customer
Since I am using What's New as my homepage, I'd like to be able to jump to post a thread from here. Thanks!

1745611875845.webp
 
Solution
HTML:
<xf:pageaction>
    <xf:if is="$xf.visitor.canCreateThread() OR $xf.visitor.canCreateThreadPreReg()">
        <xf:button href="{{ link('forums/create-thread') }}" class="button--cta" icon="write" overlay="true" rel="nofollow">
            {{ phrase('post_thread...') }}
        </xf:button>
    </xf:if>
</xf:pageaction>
HTML:
<xf:pageaction>
    <xf:if is="$xf.visitor.canCreateThread() OR $xf.visitor.canCreateThreadPreReg()">
        <xf:button href="{{ link('forums/create-thread') }}" class="button--cta" icon="write" overlay="true" rel="nofollow">
            {{ phrase('post_thread...') }}
        </xf:button>
    </xf:if>
</xf:pageaction>
 
Solution
The whats_new template, I'd put it after </xf:wrap> but it doesn't super matter.

Just as a tip, you can find the template corresponding to most pages via the data-template attribute on the <html> tag.
 
I see, we typically expect a heading of some sort, which I know you changed per the other thread ;) Since you're using it as your index, you might want one of these...

To keep the title as your board title but "What's new" as a heading:
HTML:
<xf:h1>{{ phrase('whats_new') }}</xf:h1>

To keep both the title and heading as your board title:
HTML:
<xf:title>{$xf.options.boardTitle}</xf:title>
 
Thanks I popped in the 2nd one. How can I move this button to the right like on the forum page? div align right didn't do it. Thanks again.
 
In the core, it happens when the title is displayed, but you have this in your extra.less:

Less:
[data-template="whats_new"] .p-title-value {
    display: none;
}

You can probably use visibility: hidden; instead, but otherwise I don't know of the top of my head so it's a matter of brute forcing the CSS to achieve what you want.
 
Back
Top Bottom