php - Using custom field content as expression in IF statement

Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Upd

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

I want to store some conditional logic in custom post types , and then use these in a plugin to generate new content based on the logic.

Eg if a user submits a form with “body temperature”, a conditional logic will tell the user if she has a fever or not, and some extra text.

There will be many such logic elements and I would like to maintain them from the front end.

I was thinking about putting the above into two posts. One with condition field “temperature > 37” and text “you have a fever”. Then in a plugin loop through logic records, take the conditional field and use it as the expression in an if statement.

How to make this work?

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

I want to store some conditional logic in custom post types , and then use these in a plugin to generate new content based on the logic.

Eg if a user submits a form with “body temperature”, a conditional logic will tell the user if she has a fever or not, and some extra text.

There will be many such logic elements and I would like to maintain them from the front end.

I was thinking about putting the above into two posts. One with condition field “temperature > 37” and text “you have a fever”. Then in a plugin loop through logic records, take the conditional field and use it as the expression in an if statement.

How to make this work?

Share Improve this question asked Apr 4, 2019 at 6:04 KCarterKCarter 113 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I asked the question in another group and here I got an answer that has turned out to be useful.

BE AWARE! It must be dealt with with caution as the PHP eval() function can be a significant security risk.

Find the answer here: https://stackoverflow/a/55518496/11309498

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745611685a4635981.html

相关推荐

  • php - Using custom field content as expression in IF statement

    Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Upd

    11小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信