I want to create a functions.php file in my child theme and put some code in it, but i can't do it because everytime i create a functions.php file and put a code in it an error occurs.
Does anybody know the way to do it?
<? 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);
}
?>
P.S. I use this code to automatically take the data from a submitted form (QuForm Plugin) and create a draft post. I already work it in the parent theme.
[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
functions.php
to your question please. – toscho♦ Apr 30 at 21:15<?php
– no white space inside. – toscho♦ Apr 30 at 21:24'post_content' => $content
is missing a comma. – Michael Apr 30 at 22:09