Widget Threads Enhancement

Widget Threads Enhancement [Paid] 2.1.5

No permission to buy ($30.00)
@truonglv

Would be great if there were anything you could do to improve the reliability of the "Load more..." option in the widgets. Too often you click it and nothing happens. It seems to happen most often if you stay on the same page for several minutes. Refreshing the page gets it working again, but of course that's not an ideal solution. TIA
 
You have to enable Questions in your node.

Sure, but I was thinking about the 'suggestion' threads (Up/Down Votes for first post, not posts) types.

In that way, showing threads titles with more upvotes, they go up in the widget and, showing how many 'votes' this thread have.
 
Last edited:
@truonglv

Would be great if there were anything you could do to improve the reliability of the "Load more..." option in the widgets. Too often you click it and nothing happens. It seems to happen most often if you stay on the same page for several minutes. Refreshing the page gets it working again, but of course that's not an ideal solution. TIA
It was fixed in the lastet update. What version you are using?
 
Is there any way to adjust the ratio or dimensions of the thumbnail images when displaying the Article display style ?

It shows images with a 1x1 square crop, it would be cool is you could specify the width and height of the thumbnails
 
Hey @truonglv,

Can you add this feature? To support "suggestion" threads, showing Up/Down Votes? And of course, clickable to give the vote on the widget?

I want to use for my News node, giving the user to vote the best threads showing in your widget. Would be great!
 
Feature request:

A scrolling carousel option for the article display style, like the one used in the gallery widget. So instead of needing to click "load more", they can auto scroll across (obviously with arrows to manually move)
 
Feature request:

A scrolling carousel option for the article display style, like the one used in the gallery widget. So instead of needing to click "load more", they can auto scroll across (obviously with arrows to manually move)
I've done this for anyone who wants it - it uses the inbuild XF carousel library, so you don't need to install anything else.

One thing to note, it only shows one item at a time, switching between as many as you want (so not like the gallery) - so good for use in the sidebar or on a mobile device.

Create a new template called wte_widget_carousel
Code:
<xf:if is="$threads is not empty">

    <xf:css src="wte_widget_default.less"/>
    <xf:js src="Truonglv/WidgetThreadEnhance/widget.js" min="true" addon="Truonglv/WidgetThreadEnhance" />

    <xf:css src="carousel.less" />
    <xf:css src="lightslider.less" />
    <xf:js prod="xf/carousel-compiled.js" dev="vendor/lightslider/lightslider.min.js, xf/carousel.js" />

    <div class="block wte-widget"
         {{ $autoRefreshConfig|raw }}
         {{ widget_data($widget) }}>
        <xf:if is="$options.show_expanded_title AND $title">
            <div class="block-container">
                <h3 class="block-header wte-header--carousel">{$title|raw}</h3>
            </div>
        </xf:if>
        <div class="carousel carousel--withFooter wte-widget--articles wte-widget--carousel js-threadList">
           
            <ul class="carousel-body carousel-body--show1" data-xf-init="carousel">
                <xf:foreach loop="$threads" value="$thread">
                    <li>
                        <div class="carousel-item wte-article--item">       
                            <xf:macro name="article_item"
                                      arg-allowInlineMod="{{ false }}"
                                      arg-options="{$options}"
                                      arg-post="{$thread.FirstPost}"
                                      arg-forum="{$thread.Forum}"
                                      arg-thread="{$thread}" />
                        </div>
                    </li>
                </xf:foreach>
            </ul>
           
        </div>
    </div>
</xf:if>

<xf:macro name="article_item" arg-thread="!" arg-post="!" arg-forum="!" arg-options="!">
    <xf:css src="message.less" />
    <xf:set var="$link" value="{{ link('threads', $thread) }}" />
    <xf:set var="$linkUnread" value="{{ link('threads' . (($thread.isUnread() AND $options.show_unread) ? '/unread' : ''), $thread) }}" />
    <xf:set var="$username"><xf:username user="{$thread.User}" defaultname="{$thread.username}" class="u-concealed" /></xf:set>
    <xf:set var="$ldJson" value="{{ $post ? $thread.getLdStructuredData($post) : null }}" />

    <article class="message message--article message--articlePreview {{
        $thread.discussion_state == 'moderated' ? 'is-moderated' : '' }}{{
        $thread.discussion_state == 'deleted' ? 'is-deleted' : ''
        }} js-inlineModContainer js-threadListItem-{$thread.thread_id}">
        <div class="articlePreview-main">
            <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>
            <div class="articlePreview-text">
                <div class="articlePreview-headline">
                    <h2 class="articlePreview-title">
                        <xf:if is="$thread.discussion_state == 'moderated'">
                            <xf:fa icon="fa-shield" class="structItem-status--moderated" aria-hidden="true" title="{{ phrase('awaiting_approval')|for_attr }}" />
                            <span class="u-srOnly">{{ phrase('awaiting_approval') }}</span>
                            <xf:elseif is="$thread.discussion_state == 'deleted'" />
                            <i class="structItem-status structItem-status--deleted" aria-hidden="true" title="{{ phrase('deleted')|for_attr }}"></i>
                            <span class="u-srOnly">{{ phrase('deleted') }}</span>
                        </xf:if>
                        <xf:if is="$thread.prefix_id">
                            <xf:if is="$forum">
                                <a href="{{ link('forums', $forum, {'prefix_id': $thread.prefix_id}) }}" class="labelLink" rel="nofollow">{{ prefix('thread', $thread, 'html', '') }}</a>
                            <xf:else />
                                {{ prefix('thread', $thread, 'html', '') }}
                            </xf:if>
                        </xf:if>
                        <a href="{$linkUnread}">{$thread.title}</a>
                    </h2>
                </div>
                <div class="articlePreview-content">
                    <div class="message-content js-messageContent" data-xf-init="lightbox">
                        <div class="message-userContent lbContainer js-lbContainer"
                             data-lb-id="post-{$post.post_id}"
                             data-lb-caption-desc="{{ $post.User ? $post.User.username : $post.username }} &middot; {{ date_time($post.post_date) }}">
                            <article class="message-body">
                                {{ snippet($post.message, $options.article_snippet_length, {
                                    'stripQuote': true,
                                    'bbWrapper': true
                                }) }}
                            </article>
                        </div>
                    </div>
                </div>
                <div class="articlePreview-links">
                    <ul class="articlePreview-statuses">
                        <xf:if is="$thread.isUnread()">
                            <li><span class="message-newIndicator" title="{{ !$post.isUnread() ? phrase('new_replies') : '' }}">{{ phrase('new') }}</span></li>
                        </xf:if>

                        <xf:if is="{$xf.visitor.user_id} AND {$thread.Watch.{$xf.visitor.user_id}}">
                            <li>
                                <i class="structItem-status structItem-status--watched" aria-hidden="true" title="{{ phrase('thread_watched')|for_attr }}"></i>
                                <span class="u-srOnly">{{ phrase('thread_watched') }}</span>
                            </li>
                            <xf:elseif is="!$forum AND {$thread.Forum.Watch.{$xf.visitor.user_id}}" />
                            <li>
                                <i class="structItem-status structItem-status--watched" aria-hidden="true" title="{{ phrase('forum_watched')|for_attr }}"></i>
                                <span class="u-srOnly">{{ phrase('forum_watched') }}</span>
                            </li>
                        </xf:if>

                        <xf:if is="$thread.discussion_state == 'moderated'">
                            <li>
                                <i class="structItem-status structItem-status--moderated" aria-hidden="true" title="{{ phrase('awaiting_approval')|for_attr }}"></i>
                                <span class="u-srOnly">{{ phrase('awaiting_approval') }}</span>
                            </li>
                        </xf:if>
                        <xf:if is="$thread.discussion_state == 'deleted'">
                            <li>
                                <i class="structItem-status structItem-status--deleted" aria-hidden="true" title="{{ phrase('deleted')|for_attr }}"></i>
                                <span class="u-srOnly">{{ phrase('deleted') }}</span>
                            </li>
                        </xf:if>
                        <xf:if is="!$thread.discussion_open">
                            <li>
                                <i class="structItem-status structItem-status--locked" aria-hidden="true" title="{{ phrase('locked')|for_attr }}"></i>
                                <span class="u-srOnly">{{ phrase('locked') }}</span>
                            </li>
                        </xf:if>

                        <xf:if is="$thread.sticky">
                            <li>
                                <i class="structItem-status structItem-status--sticky" aria-hidden="true" title="{{ phrase('sticky')|for_attr }}"></i>
                                <span class="u-srOnly">{{ phrase('sticky') }}</span>
                            </li>
                        </xf:if>
                    </ul>

                    <a href="{$link}">{{ phrase('view_full_article') }} &gt;</a>
                </div>
            </div>
        </div>
        <footer class="articlePreview-footer">
            <ul class="articlePreview-meta listPlain">
                <li><xf:avatar user="{$thread.User}" size="xxs" defaultname="{$thread.username}"/></li>
                <li class="articlePreview-by">{{ phrase('by_user_x', {'name':$username}) }}</li>
                <li><a href="{$link}" class="u-concealed" rel="nofollow"><xf:date time="{$thread.post_date}"/></a></li>
                <li class="u-flexStretch"><a href="{{ link('threads/post', $thread, {'post_id': $post.post_id}) }}"
                                             class="u-concealed"
                                             data-xf-init="share-tooltip"
                                             data-href="{{ link('posts/share', $post) }}"
                                             aria-label="{{ phrase('share')|for_attr }}"
                                             rel="nofollow">
                    <xf:fa icon="fa-share-alt"/>
                </a></li>
                <xf:if is="$thread.reply_count">
                    <li class="articlePreview-replies"><a href="{$linkUnread}"
                                                          title="{{ phrase('replies:') }} {$thread.reply_count|number}">
                        <xf:fa icon="fa-comment" class="u-spaceAfter" /><span class="articlePreview-repliesLabel">{{ phrase('replies:') }} </span>{$thread.reply_count|number}</a></li>
                </xf:if>
            </ul>
        </footer>

        <xf:if is="$ldJson">
            <script type="application/ld+json">
                {$ldJson|json(true)|raw}
            </script>
        </xf:if>
    </article>
</xf:macro>

Then add the follow to the bottom of your extra.less template:
Code:
.wte-widget--carousel { 
    padding: @xf-paddingMedium;
    display: block;
}

.wte-widget--carousel .wte-article--item .message--articlePreview {
    border: none;
    background-color: initial;
}

.wte-header--carousel {
    border-bottom: none;
}

Now go through creating your (article) widget as normal, but with the follow settings:

Maximum entries : How many total items you want in the carousel
Items per page : Set this to the same as above
Custom template : wte_widget_carousel

You'll then get something that looks like this :)

1655216998749.webp

Edit: Missing a class declaration, updated the template and the extra.less (14/06)
 
Last edited:
Is there any way to adjust the ratio or dimensions of the thumbnail images when displaying the Article display style ?

It shows images with a 1x1 square crop, it would be cool is you could specify the width and height of the thumbnails
It should be supported now.
 
@truonglv

Would be great if there were anything you could do to improve the reliability of the "Load more..." option in the widgets. Too often you click it and nothing happens. It seems to happen most often if you stay on the same page for several minutes. Refreshing the page gets it working again, but of course that's not an ideal solution. TIA
It was improvement in next version.
 
Top Bottom