WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Parse error: syntax error... (7 posts)

  1. moriahmac
    Member
    Posted 1 year ago #

    Hello!

    I was just in trying to edit my "functions.php" file in my Magpress theme. I copied in a code to change my excerpt character length.

    When I tried to view my page afterwards, this error came up:
    Parse error: syntax error, unexpected '<' in /home/jere7827/public_html/wp-content/themes/magpress/functions.php on line 152

    I get the same error whenever I try to load my domain name and now I am unable to log into my dashboard or anything! I used my webbrowsers back button and was able to get to the file I had edited, but even after deleting the code I inserted in and updating file, I still get the error.

    Any advice on how to proceed would be much much appreciated.

    I've read other forums about similar problems and I feel maybe I am supposed to go to my cPanel and to something there.... I'm not exactly sure what to delete and if I do delete something, will that delete everything I have done to my site so far?

    I have also contacted my theme provider as I'm unsure who I should be dealing with about this.

    Thanks in advance for any help with my site I'm working on:
    http://www.jeremystolow.com

    MM

  2. This is why we NEVER edit core theme or WP files. Especially if you don't have the experience to "fix" anything you might break.

    What you need to do is upload a fresh copy of your themes functions.php file to your installation. You can do this either with an FTP account, or via your hosts CPanel.

    Navigate to "wp-content/themes/MY_THEME" where MY_THEME is the folder name if your currently active theme.

    Once there, look for the functions.php file, and upload your fresh copy, over-writing the original.

  3. moriahmac
    Member
    Posted 1 year ago #

    Hi Josh,

    I realize now I shouldn't have tried to edit that part of the code, but the instructions I received from another website made my modification seem simple...a cut and paste... which was not the case clearly! I'm just learning :) Maybe the hard way!?

    In my cPanel, I found my functions.php file, it says it was last modified today at 1:17pm... do I just highlight that file and then press the upload button at the top of cPanel? Won't that just upload the file I tried to edit, the one I modified at 1:17 pm?

    Thanks!

  4. You need to download a fresh copy of your theme. Then, find the functions.php file. This is the "new" file (un-modified by you).

    Now, in your cPanel.. you already found the "old" functions.php file.

    So, you want to upload a new file to that same directory... and choose your "new" functions.php file to upload. You should get a prompt saying "A file with that name already exists... do you want to proceed?", or something like that... just click "Yes" or "Confirm" to over-write the "old" file with your "new" one.

  5. moriahmac
    Member
    Posted 1 year ago #

    Phew!!! Thanks for the clear instructions. That worked!!

    My site is back up and working again.

  6. moriahmac
    Member
    Posted 1 year ago #

    Thanks again.

  7. :) You bet!!

    You may also want to look into using a child theme to make modifications to your functions.php and style.css files in the future.

    It looks a little daunting at first glance... but it's really very easy.

Topic Closed

This topic has been closed to new replies.

About this Topic