I put here the essential part of the code.
It allows me to use a different HTML depending on the file published on the site.
I using this code in post content:
This code only works when I publish the file in the “content”, but doesn’t works with custom field. I want to insert this code into a custom field.