XF 2.2 Updating Free Widget Addon But ...

LPH

Well-known member
I hope this is the best place to ask because it is a free add-on I built for XF 2. I'm updating the widget so that it can show properly above the forum list.

Unfortunately, the title is using class=block-minorHeader rather than block-header. I can change the CSS through inspect and see that simple change gets what is needed. But I keep looking at the template and wondering how to modify things.

If {title} is wrapped in an h3 tag with the class=block-header and placed at the top of the template then it shows but within the widget thus duplicating the title.


Here's the template:

HTML:
<xf:foreach loop="$latestposts" value="$latestpost">

  <div class="recent_post">
    <xf:if is="{$latestpost.postThumbnailUrl} != '' ">
      <div class="thumbnail"><img src="{$latestpost.postThumbnailUrl}"></div>
    </xf:if>

    <xf:if is="{$latestpost.postThumbnailUrl} == '' ">
      <div class="trn_avatar"><xf:avatar user="$latestpost.postAuthorUser" size="xs" ></xf:avatar></div>
    </xf:if>

    <xf:if is="{$xf.options.XenLateShowCategories} == '1'">
      <div class="contentRow-minor contentRow-minor--hideLinks">
        <ul class="listInline listInline--bullet">
          <li>
            <xf:foreach loop="$latestpost.postCategoryNames" value="$Categoryname">
              <xf:if is="$latestpost.postTermId != '1'">
                <span class="wordpress_categoryname">{$Categoryname}&nbsp;</span>
              </xf:if>
            </xf:foreach>
          </li>
        </ul>
      </div>
    </xf:if>

    <span class="wordpress_title"><a href="{$latestpost.postUrl}">{$latestpost.postTitle}</a></span>

    <div class="contentRow-minor contentRow-minor--hideLinks">
      <ul class="listInline listInline--bullet">
        <li>{{ phrase('by_user_x', {'name': $latestpost.postAuthor}) }}</li>
        <li><xf:date time="{$latestpost.postDate}" /></li>
      </ul>
    </div>

    <xf:if is="{$latestpost.postExcerpt} !='' && {$xf.options.XenLateShowExcerpt} == '1'">
      <div class="excerpt">{$latestpost.postExcerpt}</div>
    </xf:if>

  </div>

</xf:foreach>

Any suggestions?
 
Well it depends, is your widget a HTML based widget or one from your custom definition ?

I believe that you are doing a HTML based widget otherwise it would show as you please.
In which case you would need to integrate the title in your template and tick the Advanced mode checkbox at the bottom when creating/editing the widget.

Or I am misunderstanding ? In which case the template here is incomplete.
 
Right. Sorry @XFA -- I was half asleep.

The challenge is -- if a user places the widget on the sidebar then it should be block-minorHeader and if placed in the page I'm designing then it should be block-header.

I'll leave it block-minorHeader in the addon template until I figure out a way.
 
Well you could add an option to the widget.
Like full (page) and simple (sidebar) and base the header code of the widget on that.

Clément
 
  • Like
Reactions: LPH
This is a good idea.

Currently, I've shifted to an XF page and template but want to change as I learn more XF.
 
Back
Top Bottom