XF 2.0 Change link in widget title or remove link altogether?

Cg1644

Member
I made a custom widget in sidebar and the posts all go to a certain room but the title of the widget is still going to the new posts page. Can I edit the title of the widget to go to the correct room? I have searched every template and phrase for days with no luck! Please help!
 
So i should add that to my extra.less? do I replace members/tpm with the link I want? Sorry, this is all so new to me.
My example is the widget made by xenMade for TPM, this is the title ;)
I can help you if you give me your code, or by PM if you don't want to make it public. ;)
 
This is my widget_new_posts template. The thing is I made my own content for the block, thats why I want to change the link cause its linking to the new poats page because that is the widget I used, so I am hoping this is the right template.


Code:
<xf:if is="$threads is not empty OR ($threads is empty AND $filter != 'latest')">
    <div class="block"{{ widget_data($widget) }}>
        <div class="block-container">
            <xf:if is="$style == 'full'">
                <h3 class="block-header">
                    <a href="{$link}" rel="nofollow">{$title}</a>
                </h3>
                <div class="block-body">
                    <div class="structItemContainer">
                        <xf:if is="$threads is not empty">
                            <xf:foreach loop="$threads" value="$thread">
                                <xf:macro template="thread_list_macros" name="item"
                                    arg-allowInlineMod="{{ false }}"
                                    arg-thread="{$thread}" />
                            </xf:foreach>
                        <xf:elseif is="$filter == 'unread'" />
                            <div class="block-row">
                                {{ phrase('no_unread_posts_view_latest', {'link': link('whats-new/posts', null, {'skip': 1})}) }}
                            </div>
                        <xf:else />
                            <div class="block-row">
                                {{ phrase('no_results_found') }}
                            </div>
                        </xf:if>
                    </div>
                </div>
                <xf:if is="$hasMore">
                    <div class="block-footer">
                        <span class="block-footer-controls">
                            <xf:button href="{$link}" rel="nofollow">{{ phrase('view_more...') }}</xf:button>
                        </span>
                    </div>
                </xf:if>
            <xf:else />
                <h3 class="block-minorHeader">
                    <a href="{$link}" rel="nofollow">{$title}</a>
                </h3>
                <ul class="block-body">
                    <xf:if is="$threads is not empty">
                        <xf:foreach loop="$threads" value="$thread">
                            <li class="block-row">
                                <xf:macro template="thread_list_macros" name="item_new_posts"
                                    arg-thread="{$thread}" />
                            </li>
                        </xf:foreach>
                    <xf:elseif is="$filter == 'unread'" />
                        <li class="block-row block-row--minor">
                            {{ phrase('no_unread_posts_view_latest', {'link': link('whats-new/posts', null, {'skip': 1})}) }}
                        </li>
                    <xf:else />
                        <li class="block-row block-row--minor">
                            {{ phrase('no_results_found') }}
                        </li>
                    </xf:if>
                </ul>
            </xf:if>
        </div>
    </div>
</xf:if>
 
This is my widget_new_posts template. The thing is I made my own content for the block, thats why I want to change the link cause its linking to the new poats page because that is the widget I used, so I am hoping this is the right template.


Code:
<xf:if is="$threads is not empty OR ($threads is empty AND $filter != 'latest')">
    <div class="block"{{ widget_data($widget) }}>
        <div class="block-container">
            <xf:if is="$style == 'full'">
                <h3 class="block-header">
                    <a href="{$link}" rel="nofollow">{$title}</a>
                </h3>
                <div class="block-body">
                    <div class="structItemContainer">
                        <xf:if is="$threads is not empty">
                            <xf:foreach loop="$threads" value="$thread">
                                <xf:macro template="thread_list_macros" name="item"
                                    arg-allowInlineMod="{{ false }}"
                                    arg-thread="{$thread}" />
                            </xf:foreach>
                        <xf:elseif is="$filter == 'unread'" />
                            <div class="block-row">
                                {{ phrase('no_unread_posts_view_latest', {'link': link('whats-new/posts', null, {'skip': 1})}) }}
                            </div>
                        <xf:else />
                            <div class="block-row">
                                {{ phrase('no_results_found') }}
                            </div>
                        </xf:if>
                    </div>
                </div>
                <xf:if is="$hasMore">
                    <div class="block-footer">
                        <span class="block-footer-controls">
                            <xf:button href="{$link}" rel="nofollow">{{ phrase('view_more...') }}</xf:button>
                        </span>
                    </div>
                </xf:if>
            <xf:else />
                <h3 class="block-minorHeader">
                    <a href="{$link}" rel="nofollow">{$title}</a>
                </h3>
                <ul class="block-body">
                    <xf:if is="$threads is not empty">
                        <xf:foreach loop="$threads" value="$thread">
                            <li class="block-row">
                                <xf:macro template="thread_list_macros" name="item_new_posts"
                                    arg-thread="{$thread}" />
                            </li>
                        </xf:foreach>
                    <xf:elseif is="$filter == 'unread'" />
                        <li class="block-row block-row--minor">
                            {{ phrase('no_unread_posts_view_latest', {'link': link('whats-new/posts', null, {'skip': 1})}) }}
                        </li>
                    <xf:else />
                        <li class="block-row block-row--minor">
                            {{ phrase('no_results_found') }}
                        </li>
                    </xf:if>
                </ul>
            </xf:if>
        </div>
    </div>
</xf:if>
You would just edit this line in your code <a href="{$link}" rel="nofollow">{$title}</a> to <a href="https://LINK/" rel="nofollow">{$title}</a>
Or remove and leave {$title}.
The h3's is the link and title.
<h3 class="block-header">
<a href="{$link}" rel="nofollow">{$title}</a>
</h3>

You could add your own link and name if you want.
Code:
<h3 class="block-header">
<a href="SITELINK" rel="nofollow">MY NAME</a>
</h3>
 
I used something like this in widget_new_posts, it could probably be done better, but it works for me:
Code:
                <h3 class="block-minorHeader">
                    <xf:if is="$title == 'Yourwidgettitle'">
                    <a href="/categories/6/" rel="nofollow">{$title}</a>
                    <xf:elseif is="$title == 'Anotherwidgettitle'" />
                    <a href="/forums/4/" rel="nofollow">{$title}</a>
                    <xf:else />
                    <a href="{$link}" rel="nofollow">{$title}</a>
                    </xf:if>
                </h3>
 
Top Bottom