Wordpress PODS magic tags extend with parameters

731 Views Asked by At

I am wondering if there's any function that I can create in order to modify the magic tags behaviour. Ideally, I would like to use a tag like this {@post_content|120} which would go through my custom function and check if there's a | character, then execute the original magic tag, while trimming text down to 120 characters. But I don't know where to hook in order to filter this content.

I know that I can pass a function name with the magic tag but this isn't really helpful as I need to pass the characters limit parameter which PODS doesn't support. Also, I can't be creating functions for all my characters limit as I have a lot of places where I need different limits and I would end up using tons of functions and no dynamic solution.

Can I somehow trigger a magic tag with a parameter? Any other thoughts about doing this another way?

Thank you!

1

There are 1 best solutions below

0
Quasel On

I don't think that's possible, {@your_field, your_function} is how it works (the function takes the field value as input) - you could use different function names like trim_120, trim_100 and do the stuff you need in there - I guess it's to create excerpts with different length's although there are other ways to do that e.g use the_content filter for one ...