• Whenever I paste code to my functions.php file I always get this message:

    Parse error: syntax error, unexpected '<' in /public_html/mysite/wp-content/themes/twentyten/functions.php on line 502

    I don’t even have 502 lines in my file. When I delete the entire file and paste a backup of the old file I still get the error. It seems like once I make a change to the file there’s no going back. I have to reinstall wordpress. How can I fix this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • fuctions.php is file that will not work with just small code mistake and will break your theme

    You do not have reinstall you can use ftp and delete the file from your theme folder and upload the same file from your computer if have copy of the theme.

    First line of file needs to be <?php and last ?>
    May the code you trying add has mistake that is it is why you getting parse error

    One more thing you should never try and make any changes in twenty ten theme create a child theme and make changes in your child theme.

    also, the error tells me you are probably nesting php code.

    often the entire functions.php is one big long block of php, so you can’t add opening and closing php tags…like this

    <?php
    .
    existing php code
    .
    you add: <?php code(); ?>
    .
    more existing code
    Thread Starter nastycanasta

    (@nastycanasta)

    Thanks a lot for your help! Didn’t know that I shouldn’t try to make changes in the default theme

    Thread Starter nastycanasta

    (@nastycanasta)

    Thanks Rev. Voodoo I added it at the end of the file but I think there wasn’t a closing php tag there.

    Didn’t know that I shouldn’t try to make changes in the default theme

    You can if you want but you will loose the changes next time you update wordpress as twenty ten theme will be over written and back to Square one where as if you created a child theme and made changes in there you will not loose your changes.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘i keep getting error when i edit my functions.php file’ is closed to new replies.