在短代码中添加多个属性:wordpress

时间:2016-10-24 07:03:16

标签: php wordpress shortcode

我需要将核心php脚本转换为带有短代码的wordpress插件,这样非技术人员也可以使用短代码轻松执行相同的任务。 在脚本中,有很多函数,每个函数都有很多属性,所以我无法理解如何正确地完成这部分。

$pdocrud = new PDOCrud();
$pdocrud->fieldTypes("about_yourself", "textarea");//change about_yourself 'textarea' to input type text
$pdocrud->fieldTypes("gender", "radio");//change gender to radio button
$pdocrud->fieldDataBinding("gender", array("male","female"), "", "","array");//add data for radio button
$pdocrud->fieldTypes("hobbies", "checkbox");//change hobbies to checkbox button
$pdocrud->fieldDataBinding("hobbies", array("Dance","Art","Games"), "", "","array");//add data for checkbox button
$pdocrud->fieldTypes("state", "select");//change state to select dropdown
$pdocrud->fieldDataBinding("state", array("Andhra Pradesh","Bihar","Patna","Gujarat","Madhya Pradesh"), "", "","array");//add data using array in select dropdown
$pdocrud->fieldTypes("country", "multiselect");//change country to multiselect dropdown
$pdocrud->fieldDataBinding("country", array("India","Brazil","UK","Pakistan"), "", "","array");//add data using array in multiselect
echo $pdocrud->dbTable("users")->render("insertform");

Here您可以找到有关该脚本的更多详细信息。我唯一需要做的就是转换脚本函数 wordpress短代码。我只能使用eval功能,但由于它不安全所以请建议一些更好的方法。请注意课程对象 在这里使用。

由于

1 个答案:

答案 0 :(得分:0)

据我所知,最佳选择是使用此插件:https://github.com/sindresorhus/gulp-ruby-sass/blob/master/index.js