r/LearnToCode • u/NotTRYINGtobeLame • Jul 21 '22
MailPoet provides example CSS code to hide certain fields from MailPoet pages. I cannot get the code to work on my WordPress site and I don't know enough to search the problem.
So, I am following the instructions provided by MailPoet here, under the header "Advanced: Filter to remove form fields".
Specifically, they provide the following code as a way to remove the first and last name fields from their form - which are useless to my site:
add_filter( 'mailpoet_manage_subscription_page_form_fields', 'mp_remove_manage_fields', 10);
function mp_remove_manage_fields( $form ) {
unset($form[0]); // First Name
unset($form[1]); // Last Name
return $form;
}Again, following their instructions (as I am a total newb at WordPress and have never touched CSS...), I added the Simple Custom CSS plug-in to which they linked. I copy/pasted the code provided, and got several flags. I modified the slashes so that "First Name" and "Last Name" are properly commented out, but I am unsure how to go about fixing the rest.
add_filter is green, but all of the arguments are flagged as invalid tokens.
The "function" line has several errors (if you need them all, let me know), unexpected tokens, expected braces, etc.
The rest of the lines all have "unset" and "form" in red, and there's an expected IDENT at the first "unset" line.
"return" is red, and so, too, is "form," again.
My theme, I guess, also has a field under Customize for "Additional CSS." I tried pasting the same code there, and got basically the same results.
Please guide me. Thanks in advance!