Graham
Mwebvendor The total comments is not in the data array.
You can do it but it involves creating a twig template switcher and adding a extra blog function on the page then inserting the value with javascript
plus it can be a bit slow as basically it loads the
entire post list and totals the comment counts and if you put the extra blog function above the main blog it changes the value of
__xtblog_block_id to 2 (that's what it's for, to identify multiple blog functions on a single page)
so the javascript needs to go below the main blog function
Rename xtblog.twig to blog.twig and create a new xtblog.twig with this code
{% if 'counter' in data.translations.t_no_entries_found%}
{%include 'com_count.twig'%}
{%else%}
{%include 'blog.twig'%}
{%endif%}
Copy code Create a new file in
_xtgem_templates called
com_count.twig{% if view == 'entries_list' %}
{% set count=0 %}
{% for entry in data.entries %}
{% set count = count+entry.comments_count %}
{% endfor %}
{{ count }}
{% endif %}
Copy code Then use this to provide the value to js
<xt:blog entries_per_page="0" version="2" t_no_entries_found="counter" />
Copy code