• Resolved siteprowizard

    (@siteprowizard)


    I am looking to see how I can use simple math operators to average 3 different fields in a single ID (post) of a pod – as it would be in the auto template of a single post – custom post type

    I know php works in the templates (though deprecated). But would use a pods plugin if I could figure out how to make that work through the auto template.

    I have tried several different ways of referencing the fields in php but the result is always empty.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    You can not do math against the fields without loading them into variables and calculating with PHP. That is not supported in Pods Templates.

    • This reply was modified 5 years, 9 months ago by Jim True.
    Thread Starter siteprowizard

    (@siteprowizard)

    Ok, thanks Jim

    So, any way to do what I need to do? – take field values for a single post and average them?

    Like I mentioned, am familiar with pods simple plugin – but not sure how to get it to just function when that particular auto template runs

    Plugin Contributor Jim True

    (@jimtrue)

    What you’re attempting to do, you would have to do with PHP, so you could not do it within an Auto Template.

    You could call a function against the post ID, like {@ID,calc_some_math}, but all loading of Meta and the math within, you need to write yourself. That’s out of scope for our support. It only gets the post ID as parameter and only has one return (which could be your string), so everything else is on you.

    Here’s the relative doc page for Output Filters with magic tags: https://docs.pods.io/displaying-pods/magic-tags/display-filters-with-magic-tags/#Using_Functions_On_Field_Output

    It’s up to you to be creative with how you use those.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using php math operators in auto template’ is closed to new replies.