• Plugin & Theme Dev

    Hey all, this is mainly aimed at @psychobunny, but if anyone else knows the answer to this question I'd be glad to hear from you, pointing at @trevor and @a_5mith

    How does one go about placing custom widgets with custom widget areas, specifically on the forums page? I have tried numerous attempts to do so but have not yet figured it out. I set the widget-area and altered the theme.js file but when I place widgets there in the ACP I get nothing. Could it have something to do with the custom-homepage plugin overriding the home.tpl template?

  • Plugin & Theme Dev Anime Lovers GNU/Linux

    Could it have something to do with the custom-homepage plugin overriding the home.tpl template?

    Perhaps, but I'm not totally sure.

    The way I place widgets is I just take whatever is a widget template and copy and paste it into one of the main theme templates such as topic.tpl or category.tpl.

    So for example, the popular tags widget (which I have not used yet but will soon), looks like this.

    <!-- BEGIN tags -->
    <a href="{relative_path}/tags/{tags.value}" class="pull-left">
    <h4>
    <span class="label label-info">{tags.value}</span>
    <small>x</small><span class="tag-topic-count">{tags.score}</span>
    </h4>
    </a>
    <!-- END tags -->

    I take that and place it somewhere (anywhere) I want it to render in a template.

    -_-

    Another example is using the widget-area as shown here using the "active users" widget (this is for category.tpl);

    Screen Shot 2014-07-23 at 3.51.41 AM.png

    And the HTML is as simple as this;

    <div class="category-active-users">
    <div widget-area="sidebar"></div>
    </div>

    Whatever is placed in widget area named "Sidebar" in the ACP, is what will render here. For this I have simply used the "Active Users" widget block as shown below.

    Screen Shot 2014-07-23 at 3.54.20 AM.png

    All in all, its a matter of preference of how you want to do things.

Suggested Topics

| |