2

recently I have gotten this error:

Parse error: syntax error, unexpected ')' in /home/aps/public_html/wp-content/themes/Valor/functions.php on line 54

I have looked at this line and found no problems, and ran it through a PHP error code finder.

Just to be sure, I copied the code from the functions.php I have saved on my computer into the editor and it still happens.

I am using wordpress and the Valor theme.

I had been editing these lines when it happened:

if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
    add_theme_support( 'post-thumbnails' );
    add_image_size( 'game_feature', 1000, 500, true );
    add_image_size( 'story_feature', 150, 100, true );
    add_image_size( 'video_feature', 150, 200, true );
    add_image_size( 'review_thumb', 120, 80, true );
    add_image_size( 'post_image', 660, 350, true );

I changed all the 'true' to 'false', because I wanted the thumbnails on my site to fit into the box, rather than be cropped. This didn't do anything so instead I just took away 'true' and 'false' entirely, leaving a blank space.

It was after I did this and hit 'save' that the error came up. I quickly went back and changed them all to 'true' in order to undo the error, but from what you can see and from what I have already told you, it didn't work, despite my efforts.

I'm very new to PHP, and the only explanation I can think of is that by deleting those values it caused another .php file to change something, but like I said, I'm new.

Line 54 is: add_image_size( 'game_feature', 1000, 500, true );

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
Zak Parker
  • 21
  • 1
  • 2
  • did you try again reloading your file as this code seems to be fine. – Sunil Verma Sep 26 '13 at 12:53
  • 1
    Your code is fine. Can you look into other parts of the file? – Pupil Sep 26 '13 at 12:54
  • Sorry I forgot to specify, I know that the code is fine. I ran it through a few checks and even copied the original code from the file on my computer onto it, and still no luck. – Zak Parker Sep 26 '13 at 12:57
  • Here is the code: http://pastebin.com/e7yDK9gx I had to put it in pastebin because it was too long to fit in here. – Zak Parker Sep 26 '13 at 13:01
  • on line 13 you have an if statement with no {}. – Jim Sep 26 '13 at 13:04
  • change true to 1 and false to 0, the only possiblity i can see is that you made a function called true and that your scripts does expect a '(' Even if the number of arguments in the add_image_size function are not correct, it would not call a parse error. – Dimitri Mostrey Sep 26 '13 at 13:07
  • That didn't work. The thing is, my site works just fine, I just cannot access my WP admin panel, except for the editor. OH Guys I just found something. This whole time I have been in the Editor and assumed it was the only thing that worked. Wrong, I have simply been hitting 'back' every time I attempted to change something, but what was actually happening is that nothing was being submitted, and I was just going back to the already loaded page! – Zak Parker Sep 26 '13 at 13:16
  • So, now I will go ahead and manually get into the functions.php through cpanel and apply all of the changes that you guys have told me, and it will probably work, so I shall do that now and tell you. – Zak Parker Sep 26 '13 at 13:17
  • It worked! Sorry about that guys, that mistake was very silly, I should have realized. Basically I just copied my original code into it. But thanks anyway for your help, much appreciated. – Zak Parker Sep 26 '13 at 13:20

2 Answers2

0

On line 13, you have:

if ( function_exists('register_sidebar') )

You forgot to put the opening quote at the end - { The line 13 should look like:

if ( function_exists('register_sidebar') ) {

EDIT:
Don't forget to close the tag on line 31. }

EDIT 2:
Try the solution that @DimitriMostrey said in the comments it might work.

change true to 1 and false to 0, the only possiblity i can see is that you made a function called true and that your scripts does expect a '(' Even if the number of arguments in the add_image_size function are not correct, it would not call a parse error.

Vlad
  • 795
  • 1
  • 12
  • 35
  • Thanks, but it's still not working. – Zak Parker Sep 26 '13 at 13:07
  • Just to be sure, I made it look like this now: `/* SIDEBARS */ if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name' => 'Sidebar', 'before_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', )); register_sidebar(array( 'name' => 'Footer', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', )); } ` – Zak Parker Sep 26 '13 at 13:07
  • I cannot see Dimitris comment. What does it say? – Zak Parker Sep 26 '13 at 13:12
  • I put it as a quote in my question. – Vlad Sep 26 '13 at 13:13