1
votes

I use Gantry5 template on WordPress CMS.

In my particle twig file exampleparticle.html.twig:

{% if particle.style == 'style2' %}
    Some title here
    {% include 'style2.html.twig' %}

On page i see text "Some title here" and under this text error:

Error while rendering exampleparticle particle.

If use this string:

{% include 'style2.html.twig' ignore missing %}

Then i see only text: "Some title here". It turns out that the system can not find the file style2.html.twig. Both files located in one directory.

P.S. Sorry for my english.

1
What's inside style2, you tried including an empty file - DarkBee
included file not empty - user2017871
No i meant try with an include that is empty :-) You probably have an error the style2 template. The questionmark dissapeared from my question - DarkBee
included file It must also have a twig markup ? - user2017871
Not required. Update question with what is inside the 2nd template? - DarkBee

1 Answers

0
votes

your if statement. it should be closed with {% endif %}

and most likely when you try to include that file twig expects some route or the file is just empty. a problem i had once looking like this was that there were 2 files in directory "partial" and file one included file two.

but {% include 'file2' %} did not work it had to be {% include 'partial/file2' %}.

so adding routing to the include and exeting the IF statement may fix your problem