Ok, I there’s been some misunderstanding on my part, sorry about that. I was asking about the output of your include snippet that used concatenating with a variable, because I couldn’t run any code from my phone and your first code snippet looked fine, so I wasn’t sure which one was broken or what error you were seeing.
Anyways, no I don’t think there’s a hack around it if your requirement is that you must be using include, because, as you probably know, it requires a string literal as an argument. Your if/elif/else chain could be put into a macro or shortcode, and whenever you add a new card template, you could just add to the chain. The macro can accepts arguments, so you can pass in your card_type there as well, and just referencing your macro from the rest of your code is more or less as concise as using include + a variable.
Otherwise, I’m having a hard time of thinking of anything that’s more generic or dynamic. Hope that helps.
That’s actually exactly what I’m doing, the snippet is already inside a macro.
But adding a new card_type requires macro editing and I’d like to avoid that.
I understand the limitation of include though, I just hoped there would be some kind of workaround.
Thx for the help anyway