制作一个插件,让我的生活更轻松,可以创建3000多个页面。看看到目前为止我所掌握的代码。
if (isset($_POST[\'action\']))
{
$one = array(
\'post_title\' => $_POST[\'title\'],
\'post_date\' => $_SESSION[\'cal_startdate\'],
\'post_content\' => \'This is a post.\',
\'post_status\' => \'publish\',
\'post_type\' => \'page\',
\'post_parent\' => $_POST[\'title\']
);
$two = array(
\'post_title\' => $_POST[\'title\'] . \' Air Conditioning\',
\'post_date\' => $_SESSION[\'cal_startdate\'],
\'post_content\' => \'This is a post.\',
\'post_status\' => \'publish\',
\'post_type\' => \'page\',
\'post_parent\' => $_POST[\'title\']
);
$post_id = wp_insert_post($one);
$post_id = wp_insert_post($two);
update_post_meta($post_id, "_wp_page_template", $_POST[\'title\'] . \'.php\');
echo $_POST[\'title\'] . \'.php\';
}
else {
}
出于某种原因,\\u wp\\u page\\u模板不起作用,这非常令人沮丧。如果我转到此代码生成的页面。。当它应该是$\\u POST[\'title\']时,它仍然会显示“默认模板”。php
如果有人能在这方面提供帮助,我们将不胜感激。
你好Brandon