Default cover image for article thread

I suggested to default to the metadata logo for the article image since everybody is likely to have that already set anyway.

 
Thats not what i mean. I want a default image as cover in the forum_view_type_article if there is no attachment.
 
Last edited:
Even better, I'd like to see an option to set that image based on forumname.01, forumname.02, etc.
Yeah, having default images set at the node (forum) would be nice.
Thats not what i mean. I want an default image as cover in the thread view if there is no attachment.
Whoops, I thought you meant forum view listing (what my suggestion covers) but see now you are talking specifically thread view while viewing the article. 👍
 
In my case, I use the Article layout for Classifieds, and the desktop view is a mess when there is no default.

Same thing I'm doing as well which led to that suggestion thread. I did a edit to use the metadata logo for threads that don't have an image in the first post. It was driving me nuts viewing the listing when there were no images.

 
Whoops, I thought you meant forum view listing (what my suggestion covers) but see now you are talking specifically thread view while viewing the article. 👍
No, i wasn't correct. I mean the forum_view_type_article, the listing of all threads.
 
After your edit with the screenshots... We're back to my first response. 😁
Not exactly. I don't want the metadata logo. I want an option in acp for a forum with article thread type where i can set/upload a default cover image that will shown if no attachment is uploaded to the thread.
 
It can be achieved with a simple template edit.

Edit the post_article_macros template.

Look for:
HTML:
<xf:if is="$thread.cover_image">
    <a href="{$linkUnread}" class="articlePreview-image" style="background-image: url('{$thread.cover_image}')" aria-hidden="true" tabindex="-1">&nbsp;</a>
</xf:if>

Replace with:
HTML:
<xf:if is="$thread.cover_image">
    <a href="{$linkUnread}" class="articlePreview-image" style="background-image: url('{$thread.cover_image}')" aria-hidden="true" tabindex="-1">&nbsp;</a>
<xf:else />
    <a href="{$linkUnread}" class="articlePreview-image" style="background-image: url('{{ {$xf.options.boardUrl}.'/styles/default/xenforo/xenforo-icon-large.png' }}')" aria-hidden="true" tabindex="-1">&nbsp;</a>
</xf:if>

You can then expand that as required to use conditional statements related to node IDs with a fallback to the generic icon:
HTML:
<xf:if is="$thread.cover_image">
    <a href="{$linkUnread}" class="articlePreview-image" style="background-image: url('{$thread.cover_image}')" aria-hidden="true" tabindex="-1">&nbsp;</a>
<xf:elseif is="$forum.node_id == 2" />
    <a href="{$linkUnread}" class="articlePreview-image" style="background-image: url('{{ {$xf.options.boardUrl}.'/styles/default/xenforo/node-2-icon.png' }}')" aria-hidden="true" tabindex="-1">&nbsp;</a>
<xf:elseif is="$forum.node_id == 8" />
    <a href="{$linkUnread}" class="articlePreview-image" style="background-image: url('{{ {$xf.options.boardUrl}.'/styles/default/xenforo/node-8-icon.png' }}')" aria-hidden="true" tabindex="-1">&nbsp;</a>
<xf:else />
    <a href="{$linkUnread}" class="articlePreview-image" style="background-image: url('{{ {$xf.options.boardUrl}.'/styles/default/xenforo/xenforo-icon-large.png' }}')" aria-hidden="true" tabindex="-1">&nbsp;</a>
</xf:if>
 
Top Bottom