I'm trying to show the other entries assigned to the same nested category (on an entry template) but get an error if I use .last() which I was hoping would show the nested category assigned entries (and not all assigned to all levels of the same category, Any ideas?
{# set the category group #}
{% set categoryGroup = craft.categories.group('products') %}
{% set entries = craft.entries.relatedTo(categoryGroup) %}
{# only show entries assigned to the same nested category #}
{% for sameCat in entries.last() %}
<p>{{ sameCat.title }}</p>
{% endfor %}
{# note: using .last throws error – Impossible to access an attribute ("title") on a string variable ("1").
#}