我想创建一个函数。php文件,并在其中放入一些代码,但我不能这样做,因为每次我创建一个函数。php文件,并在其中放入代码时出错。
有人知道怎么做吗?
<? php
add_action(\'iphorm_post_process_1\', \'mytheme_create_wp_post\', 10, 1);
function mytheme_create_wp_post($form)
{
$title = $form->getValue(\'iphorm_1_1\');
$content = \'Content: \' . $form->getValueHtml(\'iphorm_1_30\') . \'<br />\';
$content .= \'Link: \' . $form->getValueHtml(\'iphorm_1_11\') . \'<br />\';
$content .= \'Creator: \' . $form->getValueHtml(\'iphorm_1_36\') . \'<br />\';
$content .= \'Category: \' . $form->getValueHtml(\'iphorm_1_39\') . \'<br />\';
$content .= \'Facebook: \' . $form->getValueHtml(\'iphorm_1_26\') . \'<br />\';
$content .= \'Area: \' . $form->getValueHtml(\'iphorm_1_15\') . \'<br />\';
$content .= \'Date: \' . $form->getValueHtml(\'iphorm_1_8\') . \'<br />\';
$content .= \'Time: \' . $form->getValueHtml(\'iphorm_1_9\') . \'<br />\';
$content .= \'Terms: \' . $form->getValueHtml(\'iphorm_1_32\') . \'<br />\';
$content .= \'Info: \' . $form->getValueHtml(\'iphorm_1_35\') . \'<br />\';
$post = array(
\'post_title\' => $title,
\'post_content\' => $content
\'post_status\' => \'draft\'
);
wp_insert_post($post);
}
?>
另外,我使用此代码自动从提交的表单(QuForm插件)中获取数据,并创建一个草稿帖子。我已经在父主题中使用了它。
[Wed May 01 00:26:01 2013] [warn] [client 188.4.45.92] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \')\' in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 20, referer: http://www.e-win.gr/
[Wed May 01 00:26:06 2013] [warn] [client 216.52.242.14] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \')\' in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 20
[Wed May 01 00:26:06 2013] [warn] [client 188.4.45.92] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \')\' in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 20, referer: http://www.e-win.gr/
[Wed May 01 00:26:23 2013] [warn] [client 188.4.45.92] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \')\' in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 21, referer: http://www.e-win.gr/wp-admin/admin.php?page=options.php
[Wed May 01 00:29:12 2013] [warn] [client 188.4.45.92] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \')\' in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 21, referer: http://www.e-win.gr/wp-admin/admin.php?page=options.php
[Wed May 01 00:29:41 2013] [warn] [client 157.56.93.230] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \')\' in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 21
[Wed May 01 00:29:46 2013] [warn] [client 173.199.114.187] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \')\' in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 21
[Wed May 01 00:30:08 2013] [warn] [client 188.4.45.92] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \')\' in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 21, referer: http://www.e-win.gr/wp-admin/admin.php?page=options.php
[Wed May 01 00:37:57 2013] [warn] [client 188.4.45.92] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected $end in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 31, referer: http://www.e-win.gr/wp-admin/admin.php?page=options.php
[Wed May 01 00:42:05 2013] [warn] [client 188.4.45.92] mod_fcgid: stderr: PHP Parse error: syntax error, unexpected $end in /var/www/vhosts/e-win.gr/httpdocs/wp-content/themes/e-win/functions.php on line 31, referer: http://www.e-win.gr/wp-admin/options-general.php?page=wp-viewer-log