我购买了 WPBakery Page Builder 附带的主题,
我有大约 100 个风格相同的帖子,
我计划再导入大约 6,000 个,但这次是以编程方式。
使用 WPBakery,我可以导出示例页面,然后生成以下代码:
YToxOntpOjA7YTozOntzOjM6InVpZCI7czo5OiJjN2JlMGRkMjciO3M6NDoiYXR0ciI7YToxODp7czo1OiJ0aXRsZSI7czowOiIiO3M6ODoiYmdfY29sb3IiO3M6MDoiIjtzOjg6ImJnX2ltYWdlIjtzOjA6IiI7czoxMToiYmdfcG9zaXRpb24iO3M6MjA6Im5vLXJlcGVhdDtsZWZ0IHRvcDs7IjtzOjc6ImJnX3NpemUiO3M6NDoiYXV0byI7czoxMjoiYmdfdmlkZW9fbXA0IjtzOjA6IiI7czoxMjoiYmdfdmlkZW9fb2d2IjtzOjA6IiI7czoxMToicGFkZGluZ190b3AiO3M6MToiMCI7czoxNDoicGFkZGluZ19ib3R0b20iO3M6MToiMCI7czo3OiJkaXZpZGVyIjtzOjA6IiI7czo5OiJkZWNvcl90b3AiO3M6MDoiIjtzOjEyOiJkZWNvcl9ib3R0b20iO3M6MDoiIjtzOjEwOiJuYXZpZ2F0aW9uIjtzOjA6IiI7czo1OiJzdHlsZSI7czowOiIiO3M6NToiY2xhc3MiO3M6MDoiIjtzOjEwOiJzZWN0aW9uX2lkIjtzOjA6IiI7czoxMDoidmlzaWJpbGl0eSI7czowOiIiO3M6NDoiaGlkZSI7czowOiIiO31zOjU6IndyYXBzIjthOjE6e2k6MDthOjQ6e3M6MzoidWlkIjtzOjk6ImU0Yjk0YzViYSI7czo0OiJzaXplIjtzOjM6IjEvMSI7czo1OiJpdGVtcyI7YTo1OntpOjA7YTo0OntzOjQ6InR5cGUiO3M6OToibWFwX2Jhc2ljIjtzOjM6InVpZCI7czo5OiJkNWRkMGY1MDQiO3M6NDoic2l6ZSI7czozOiIxLzEiO3M6NjoiZmllbGRzIjthOjQ6e3M6NjoiaWZyYW1lIjtzOjA6IiI7czo3OiJhZGRyZXNzIjtzOjUwOiIyMD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s:3:"uid";s:9:"c7be0dd27";s:4:"attr";a:18:{s:5:"title";s:0:"";s:8:"bg_color";s:0:"";s:8:"bg_image";s:0:"";s:11:"bg_position";s:20:"no-repeat;left top;;";s:7:"bg_size";s:4:"auto";s:12:"bg_video_mp4";s:0:"";s:12:"bg_video_ogv";s:0:"";s:11:"padding_top";s:1:"0";s:14:"padding_bottom";s:1:"0";s:7:"divider";s:0:"";s:9:"decor_top";s:0:"";s:12:"decor_bottom";s:0:"";s:10:"navigation";s:0:"";s:5:"style";s:0:"";s:5:"class";s:0:"";s:10:"section_id";s:0:"";s:10:"visibility";s:0:"";s:4:"hide";s:0:"";}s:5:"wraps";a:1:{i:0;a:4:{s:3:"uid";s:9:"e4b94c5ba";s:4:"size";s:3:"1/1";s:5:"items";a:5:{i:0;a:4:{s:4:"type";s:9:"map_basic";s:3:"uid";s:9:"d5dd0f504";s:4:"size";s:3:"1/1";s:6:"fields";a:4:{s:6:"iframe";s:0:"";s:7:"address";s:50:"205 catherine street, ottawa ";s:4:"zoom";s:2:"13";s:6:"height";s:3:"300";}}i:1;a:4:{s:4:"type";s:13:"fancy_heading";s:3:"uid";s:9:"80a785149";s:4:"size";s:3:"1/3";s:6:"fields";a:8:{s:5:"title";s:0:"";s:2:"h1";s:1:"0";s:7:"content";s:52:"<h2><a href="tel:613-228-6700">613-228-6700</a></h2>";s:5:"style";s:4:"icon";s:4:"icon";s:9:"icon-call";s:6:"slogan";s:0:"";s:7:"animate";s:0:"";s:7:"classes";s:0:"";}}i:2;a:4:{s:4:"type";s:13:"fancy_heading";s:3:"uid";s:9:"c08ff4596";s:4:"size";s:3:"1/3";s:6:"fields";a:8:{s:5:"title";s:0:"";s:2:"h1";s:1:"0";s:7:"content";s:87:"<h2><a href="mailto:contact@luclaverdure.com">contact@luclaverdure.com</a></h2>";s:5:"style";s:4:"icon";s:4:"icon";s:10:"icon-email";s:6:"slogan";s:0:"";s:7:"animate";s:0:"";s:7:"classes";s:0:"";}}i:3;a:4:{s:4:"type";s:13:"fancy_heading";s:3:"uid";s:9:"jonmbii3x";s:4:"size";s:3:"1/3";s:6:"fields";a:8:{s:5:"title";s:0:"";s:2:"h1";s:1:"0";s:7:"content";s:83:"<h2><a href="http://luclaverdure.com" target="_blank">luclaverdure.com</a></h2>";s:5:"style";s:4:"icon";s:4:"icon";s:9:"icon-link";s:6:"slogan";s:0:"";s:7:"animate";s:0:"";s:7:"classes";s:0:"";}}i:4;a:4:{s:4:"type";s:10:"blockquote";s:3:"uid";s:9:"84e0f221a";s:4:"size";s:3:"1/1";s:6:"fields";a:5:{s:7:"content";s:377:"Blablabla1234 ";s:6:"author";s:0:"";s:4:"link";s:0:"";s:6:"target";s:1:"0";s:7:"classes";s:0:"";}}}s:4:"attr";a:9:{s:8:"bg_color";s:0:"";s:8:"bg_image";s:0:"";s:11:"bg_position";s:20:"no-repeat;left top;;";s:7:"bg_size";s:4:"auto";s:7:"move_up";s:0:"";s:7:"padding";s:0:"";s:13:"column_margin";s:0:"";s:14:"vertical_align";s:3:"top";s:5:"class";s:0:"";}}}}}
如何以编程方式将此 json 配置导入 wordpress...
伪代码:
foreach(postToImport) {
// @wp_insert_post funk?
TheMagicImportFunctionINeed(base64(json));
}
请帮我解决这个问题,
谢谢!