December 6, 2010

Textual description of firstImageUrl

How To Fix Parse Error: Syntax Error, Unexpected Wordpress

|
I know this tutorial has nothing to do with Blogger. But it is for those of you who have just  either  migrated (redirected) or set up your first self-hosted WordPress site after having their blogs deleted as spam by Google.

For newbies, using WordPress for the first time can be daunting and exasperating. You just look at the number of questions ask daily over at the WordPress forums.

The topic I am talking about today is about how to fix Parsed Error Parse error: syntax error, unexpected

As I have mentioned earlier, I know many of you who had been using Blogger and are not very familiar with WordPress.

I am also one of them. One of the major problems which many new WordPress users is going to encounter is screwing up the functions php code while they are trying to paste or remove codes on function php template.

 And the next thing you are stuck! No matter what you try to do, you keep getting the message similar to this one: Parse error: syntax error, unexpected '<' in /home/webinternet/public_html/(name of yourblog)/wp-content/themes/(name of your theme)/functions.php on line 11.

I have even tried deleting the whole function php codes and replaced it with a fresh codes (which I have saved on my Notepad earlier and also from the zip file), still I received the horrible "Parse error:syntax error, unexpected" message. In other words, the problem is still there.

You see all this time when you used Blogger, and if you happened to screw up the code on the template while pasting or removing some codes, there is no major problem.

Because you cannot save the template. It will remind you with red texts telling you that it cannot be parsed because of some kind of technical hiccups, right?

But when it comes to WordPress, it is a different story. Even though you have already screwed up the code (without your knowledge) while installing a plugin or adding some code, it will still says: "File edited successfully", after you clicked on Update File at the bottom left hand corner of the template.

Now however or wherever you click, it will keep showing that "Parse error" message. You are stuck and lost! I have been there a couple of times already.

Desperately, I started searching around the Internet for help; reading and re-reading many confusing explanations, advice and tutorials.

It is not their faults, but rather mine. As I am no tech-savvy, when they mentioned all those jargon like ftp, syntax error, re-uploading the wp-admin, file management application, root directory and whatnot confused me even more.

Out of anger, I clicked it off and I tried to start again. Thinking I could log in afresh. But to my horror, I cannot even see the WordPress log in box anymore, but the same stubborn white screen with the same "Parse error" message staring at me!

Now I cannot access my blog or site. I cannot go in to rectify or repair the messed up template.

Doesn't it sound familiar to many of you first-time user of WordPress?

What I am going to show you is from my own experience. I purposely wrote this article and have it posted here as a personal reference; if I ever screwed up the template code and the "Parse error " comes haunting me again, then I know what to do. Another thing is I have backup this post in case this blog got deleted by Google just like so many these days.

Of course I have also read some other methods of fixing this WordPress "Parse Error syntax error, unexpected" problem.

The next method is rather difficult for many of us who are "IT-idiot" like me. You have to look for the line which is causing the error as indicated in the parse error message. Then you need to put back the missing dots, semi-colon, curly brackets, braces, or spacing. to make sure that  the code are set up properly.  
  
Alright, before I show you how I have fixed my Parse error: syntax error, unexpected" problem, I would like you to you know that my site is hosted with Bluehost. So my  explanations and images are based on Bluehost.

Here we go:

Before you start, you need to go to your Theme zip file and obtain its functions.php code.  Double click on the functions.php and it shows you a page of code. This is the code which you will be using for step #10 below.


Firstly you need to go to your hosting provider. For me it is Bluehost. 

1. Log in to your Bluehost account and you can see this page called cPanel (circled in red)  

Look for "Frequently Accessed Areas" on the left hand side or you can also find File Manager on the right hand side under the section Files. Click on it.



2. Now click File Manager. It will pop up a menu box called File Manager Directory Selection

Click on the white spot for Document Root for: Then select the site which has parse error as indicated in the white box. Then click Go. (Refer Below)



3. You see page called File Manager Setting. Tick the box beside the word wp-content. Now double click on the word wp-content which is on the right hand side of the page.(Below)


4. Now it will show this. Double click on the word Theme.


5. Now select your own theme and double click on it


6. I want you to right click on the word function.php as shown below.


7. Now a dark grey/gray popup box will appear next to it. See below.



8. Right click on the word Edit in the dark gray box.


9. A Text Editor popup box will appear like the one as shown below. Click the word Edit.  


10. Now you will see a white page filled with code. Now delete all the code away and paste a fresh function.php code which I told you to get it earlier from your zip file.

Then click Save Changes which is on the top right hand corner.   


That's is how to fix the WordPress parse error syntax error unexpected...problem. If you find this tutorial useful, please share it with other new or first-time WordPress users. They will appreciate you.