Tagged: rich snippets, schema, syntax error
Hello,
I wanted to add a couple of new Rich Snippets to functions.php in Appearance > Theme Editor but when I try to add the code, I get this error message:
Your PHP code changes were rolled back due to an error on line 46 of file wp-content/themes/enfold-child/functions.php. Please fix and try saving again.
syntax error, unexpected ‘<‘, expecting end of file
For each of the snippets, they both show no errors or warnings when tested in Google Structured Data Testing Tool, so I’m not sure what to do here. Any help would be greatly appreciated.
Logins are below along with both snippets.
Thank you for your time.
Hey eskitaco,
Are you simply adding the scripts without a function? If so then that is not possible, hence the name functions.php. Try something like this instead:
function eskitaco_add_script_1() {
?>
Your script goes here
<?php
}
add_action('wp_footer', 'eskitaco_add_script_1');
Best regards,
Rikard
Ah yes, that makes sense now. I’m learning as I go. Thank you for the info, Rikard. The thread can be closed.