Support » Fixing WordPress » Parse error function.php

  • At http://www.cultureyard.net
    I changed the code in the functions.php and got this error:

    Parse error: syntax error, unexpected $end in /home/ilyac/webapps/wordpress/wp-content/themes/cyard_061111/functions.php on line 48

    I tried to restore it from my backup but it doesn’t make a difference.

    My functions.php looks like this:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Backticks not single quote. ]

    <?php if ( function_exists('register_sidebar') )
    {
    register_sidebar(array('name' => 'Sidebar Top','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
    register_sidebar(array('name' => 'Sidebar Left','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
    register_sidebar(array('name' => 'Sidebar Right','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
    register_sidebar(array('name' => 'Sidebar Bottom','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
    register_sidebar(array('name' => 'Footer Left','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
    register_sidebar(array('name' => 'Footer Center','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
    register_sidebar(array('name' => 'Footer Right','before_widget' => '','after_widget' => '','before_title' => '<h3>','after_title' => '</h3>'));
    } 
    
    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'custom_trim_excerpt');
    
    function custom_trim_excerpt($text) { // Fakes an excerpt if needed
    global $post;
    if ( '' == $text ) {
    $text = get_the_content('');
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);
    $text = strip_tags($text);
    $excerpt_length = 90;
    $words = explode(' ', $text, $excerpt_length + 1);
    if (count($words) > $excerpt_length) {
    array_pop($words);
    array_push($words, '...');
    $text = implode(' ', $words);
    }
    }
    return $text;
    }
    
    ?>

    Grateful for any help. I’m fairly new at this.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Adrian

    (@adrianfraguela)

    Could you kindly paste this code into Pastebin and send us link, it is easier to manage that way.

    Also, what code did you add in?

    Thanks for your reply Adrian – appreciate it.

    The original functions.php file looked like this:

    http://pastebin.com/ngyCmz3J

    It was changed to look like this:

    http://pastebin.com/AkTTuvXh

    Everything was working fine, until I tried to move lines 6-9 in the code immediately above this paragraph to the section below under line 15. That’s when the parse error happened.

    Adrian

    (@adrianfraguela)

    Thanks, but same error:

    Parse error: syntax error, unexpected $end in /home/ilyac/webapps/wordpress/wp-content/themes/cyard_061111/functions.php on line 48

    Adrian

    (@adrianfraguela)

    http://pastebin.com/qFHsCKq4 This one? You don’t have your widths and heights set in the post thumbnail declaration.

    Same error, could it be hacked?

    Adrian

    (@adrianfraguela)

    Take a look here about excrepts.

    It could be another plugin conflicting. Try and disable all plugins and then enable one by one to see which one could be causing the problem.

    I can’t access the dashboard at all

    Adrian

    (@adrianfraguela)

    If you remove the code you added in your functions, and leave the original stuff then it will come back to life.

    hey, I tried and really nothing works. Thanks for your suggestions, and maybe it’s just my lack of experience here, I’ve tried removing the code and i’ve tried all the suggestions, but it’s just the same error whenever I try to access any part of the dashboard of website

    Same problem here… !
    I feel so stupid.
    Copied the original text, just to be safe, but when I got the parse error and I copied the original back it didn’t work.
    I tried to access it through ‘files’ and got in. When I try to overwrite and save it, it would not be saved.
    So the corrupted file (due to my own doing) can’t be replaced with the original file as it now seems.

    Can anyone help me out… I am kind of panicing here.
    I am using blogolife as a theme by the way.

    Thank you in advance !
    Petra
    http://www.pluimveebedrijfdetoekomst.nl

    This is what I get when trying to save the original file:

    Unable to save your changes

    Details

    Unable to open /domains/pluimveebedrijfdetoekomst.nl/public_html/wp-content/themes/blogolife/functions.php for writing

    I DID IT !

    Uninstalled blogolife en installed it again.
    You can’t even imagine how happy I am now.

    Thanks for ‘listening’ :)))))

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Parse error function.php’ is closed to new replies.