Custom Template

Since ver.1.0, this addon uses underscore.js for templating.

underscore.js uses <%- XXX %>, where XXX will be a variable name, will be replaced by a data.

For exmple, <%- url %> will be replaced by "http://example.com/sample-page".

 

blocks/recent_views/templates/withimage/view.php

<script id="recent_views<?php echo $bID;?>" type="text/javascript">// <![CDATA[
<div class="recent_views_image"><img src="<%- thumbnail %>"> </div>
<div class="recent_views_text"> <a href="<%- url %>" target="_self"><%- title %></a>
<p><%- description %></p> </div>
// ]]></script>

 

variables for template

thumbnail
url
title
description

 

div.recent_views data attributes allow some setting.

data-noimg : a image when the page has no thumbnail.

data-title : the title setting. headertitle - text in the <head><title>. pagetitle - pagetitle you have inserted in composer.