Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1086184

    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.

    #1086456

    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

    #1086716

    Ah yes, that makes sense now. I’m learning as I go. Thank you for the info, Rikard. The thread can be closed.

    #1086903

    Hi,

    We all do. We’ll close the thread now.
    Thank you for using Enfold.

    Best regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Adding Rich Snippets to Theme Editor Error’ is closed to new replies.