我是Wordpress插件开发新手,但一般来说,我不熟悉web开发。我有一个网站,我正在尝试将其功能移植到Wordpress,以便客户端在自定义插件和主题中使用它。
在我的另一个(非Wordpress)网站上,这是一个商店页面,我无法作为客户端编辑商店项目,它都是硬编码为一个复杂的JSON,带有嵌套的数组和对象,不适合MySQL。
摘录(来自角度控制器):
$scope.theBreadsList = [{
category: \'Daily Breads\',
breads: [{
text: \'Apple Streusel\',
category: \'Daily Breads\',
type: \'Apple Streusel\',
instance: 0,
isDaily: true,
price: 7.25,
quantity: 0,
days: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday"],
daysNotAvailable: null,
onMenu: true,
canSlice: false,
orderDates: [],
theActualOrderDate: "",
shipping: false,
ingredients: ["White Flour", "Honey", "Water", "Butter", "Brown Sugar", "Eggs", "Applesauce", "Apples", "White Sugar", "Yeast", "Spices", "Vanilla", "Salt"]
},
{
text: \'Honey Whole Wheat\',
category: \'Daily Breads\',
type: \'Honey Whole Wheat\',
instance: 0,
isDaily: true,
price: 5.65,
quantity: 0,
days: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday"],
daysNotAvailable: null,
onMenu: true,
canSlice: true,
orderDates: [],
theActualOrderDate: "",
shipping: false,
ingredients: ["Organic Whole Wheat Flour","Filtered Water","Honey","Yeast","Salt"],
},
基本上,对于Wordpress插件,我希望客户端能够输入此类类别和面包(或任何其他类型的项目)以及所有相关数据,然后添加到该格式中,以便我的Angular脚本读取。
因为我无法想象如果不将其作为JSON存储在数据库本身中(因为它太复杂)如何做到这一点,我一直在思考如何让客户端从插件中编辑数据结构。
抱歉,这太模糊了,但我希望有人能在概念上帮助我做些什么。