{"id":7435498,"date":"2016-05-31T23:48:29","date_gmt":"2016-05-31T23:48:29","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/parse-error-syntax-error-unexpected-when-editing-functionphp\/"},"modified":"2016-08-31T18:37:17","modified_gmt":"2016-08-31T18:37:17","slug":"parse-error-syntax-error-unexpected-when-editing-functionphp","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/parse-error-syntax-error-unexpected-when-editing-functionphp\/","title":{"rendered":"Parse error: syntax error, unexpected &#039;{&#039; when editing function.php"},"content":{"rendered":"<p>I am trying to add some extra fields to the registration form in Woocommerce by following the post on<\/p>\n<ul>\nhttp:\/\/www.themelocation.com\/how-to-add-custom-fields-to-user-registration-form-in-woocommerce\/<\/ul>\n<p>, but I am getting the following error:<br \/>\n&#8221; Parse error: syntax error, unexpected &#8216;{&#8216; in C:\\Apache24\\htdocs\\wordpress\\wp-content\\themes\\flatsome\\functions.php on line 14&#8243;<\/p>\n<p>Here is the code:<\/p>\n<pre><code>&lt;?php\n\/**\n * Flatsome functions and definitions\n *\n * @package flatsome\n *\/\n\nrequire get_template_directory() . &#039;\/inc\/init.php&#039;;\n\n\/**\n * Note: Do not add any custom code here. Please use a child theme so that your customizations aren&#039;t lost during updates.\n * https:\/\/codex.wordpress.org\/Child_Themes\n *\/\nfunction wooc_extra_register_fields(){\n?&gt;\n\n&lt;p class=&quot;form-row form-row-first&quot;&gt;\n&lt;label for=&quot;reg_billing_first_name&quot;&gt;&lt;?php _e( &#039;First name&#039;, &#039;woocommerce&#039; ); ?&gt;&lt;span class=&quot;required&quot;&gt;*&lt;\/span&gt;&lt;\/label&gt;\n&lt;input type=&quot;text&quot; class=&quot;input-text&quot; name=&quot;billing_first_name&quot; id=&quot;reg_billing_first_name&quot; value=&quot;&lt;?php if ( ! empty( $_POST[&#039;billing_first_name&#039;] ) ) esc_attr_e( $_POST[&#039;billing_first_name&#039;] ); ?&gt;&quot; \/&gt;\n&lt;\/p&gt;\n\n&lt;p class=&quot;form-row form-row-last&quot;&gt;\n&lt;label for=&quot;reg_billing_last_name&quot;&gt;&lt;?php _e( &#039;Last name&#039;, &#039;woocommerce&#039; ); ?&gt;&lt;span class=&quot;required&quot;&gt;*&lt;\/span&gt;&lt;\/label&gt;\n&lt;input type=&quot;text&quot; class=&quot;input-text&quot; name=&quot;billing_last_name&quot; id=&quot;reg_billing_last_name&quot; value=&quot;&lt;?php if ( ! empty( $_POST[&#039;billing_last_name&#039;] ) ) esc_attr_e( $_POST[&#039;billing_last_name&#039;] ); ?&gt;&quot; \/&gt;\n&lt;\/p&gt;\n\n&lt;div class=&quot;clear&quot;&gt;&lt;\/div&gt;\n\n&lt;p class=&quot;form-row form-row-wide&quot;&gt;\n&lt;label for=&quot;reg_billing_phone&quot;&gt;&lt;?php _e( &#039;Phone&#039;, &#039;woocommerce&#039; ); ?&gt;&lt;span class=&quot;required&quot;&gt;*&lt;\/span&gt;&lt;\/label&gt;\n&lt;input type=&quot;text&quot; class=&quot;input-text&quot; name=&quot;billing_phone&quot; id=&quot;reg_billing_phone&quot; value=&quot;&lt;?php if ( ! empty( $_POST[&#039;billing_phone&#039;] ) ) esc_attr_e( $_POST[&#039;billing_phone&#039;] ); ?&gt;&quot; \/&gt;\n&lt;\/p&gt;\n\n&lt;?php\n}\nadd_action( &#039;woocommerce_register_form_start&#039;, &#039;wooc_extra_register_fields&#039; );<\/code><\/pre>\n<p>Can Anyone Help me solving this problem ?!!<\/p>\n","protected":false},"template":"","class_list":["post-7435498","topic","type-topic","status-publish","hentry","topic-tag-function-php","topic-tag-registration-form"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7435498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7435498\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7435498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}