XF 2.2 Show Custom Thread Fields In Thread Listing

Foxtrek_64

Member
As it says on the tin-

I want to show a particular custom thread field in the thread listing. Is such possible out of the gate or would I need to modify the template?
 
Solution
It needs a template edit or modification

Depending on how you want it to show, in template thread_list_macros you could try this:

Find
<ul class="structItem-parts">

And add this (where "ID" is the custom thread field ID)



Code:
   <xf:if is="$thread.custom_fields.ID">
                    <li>Price: {$thread.custom_fields.ID}</li>
                </xf:if>

Alternatively it could go under structItem-cell--latest or structItem-cell--meta
Like a "favorite x" in the postbit info? Above or below post? Both are possible. But I'm on mobile for a couple days, so hopefully someone else can screenshot it.
 
Like a "favorite x" in the postbit info? Above or below post? Both are possible. But I'm on mobile for a couple days, so hopefully someone else can screenshot it.
I have it displaying in the thread view like I want it, but I need it to display in the thread listing i.e. when you're viewing the list of threads in the forum.
 
It needs a template edit or modification

Depending on how you want it to show, in template thread_list_macros you could try this:

Find
<ul class="structItem-parts">

And add this (where "ID" is the custom thread field ID)



Code:
   <xf:if is="$thread.custom_fields.ID">
                    <li>Price: {$thread.custom_fields.ID}</li>
                </xf:if>

Alternatively it could go under structItem-cell--latest or structItem-cell--meta
 
Last edited:
Solution
It needs a template edit or modification

Depending on how you want it to show, in template thread_list_macros you could try this:

Find
<ul class="structItem-parts">

And add this (where "ID" is the custom thread field ID)



Code:
   <xf:if is="$thread.custom_fields.ID">
                    <li>Price: {$thread.custom_fields.ID}</li>
                </xf:if>

Alternatively it could go under structItem-cell--latest or structItem-cell--meta
Thanks, I'll give this a shot when I'm home from work
 
Came up with the following. It mostly works except for the coloring on the owned threads. Anyone know what I'm looking at here, and/or have any nits/suggestions?

PHP:
<li>
    <xf:if is="$thread.custom_fields.ticketOwner">
        <div class="structItem-minor">
            <xf:if is="$xf.visitor.username == $thread.custom_fields.ticketOwner">
                {{ phrase('application_claimed_by') }}: <span style="color: {$xf-paletteAccent2}">{$thread.custom_fields.ticketOwner}</span>
            <xf:else />
                {{ phrase('application_claimed_by') }}: {$thread.custom_fields.ticketOwner}
            </xf:if>
        </div>
        <xf:else />
        <div class="structItem-minor">
            <span style="color: red;">{{ phrase('application_unclaimed') }}</span>
        </div>
    </xf:if>
</li>
 
Wrap whatever you want coloured in a div with a class you can style in extra.less. Easier to cope with that what you have done here with the inline style.
 
Last edited:
Top Bottom