Hi all. I’d like to add the text “no posts found” in my multiple blogs when no posts are present on a certain month.
I use the standard “Archives” plugin by TeamGrav.
I think i have to write a {% if %} condition in the following code:
My problem is I’m no coder, so I need same help in writing the correct {% if %} condition for missing posts and pasting it in the above code, something like
{% if items = 0 %}
<p>No posts found for this month.</p>
{% endif %}
@maria, Having taken a look at the Archives plugin, I get the impression that the array ‘archives_data’ only contains year/month combinations for which at least 1 item exist.
That means that {% if (items|length) == 0 %} never happens…
Thank you so much for correcting my “If” code. Now a further question: how can I alter the default archives.htm.twig file to add the “if” condition? Coming from Joomla (completely different environment!!) my learning curve especially about twig s painfully slow …