WordPress.org

Ready to get started?Download WordPress

Forums

Parse error function.php (14 posts)

  1. Ged_CY
    Member
    Posted 1 year ago #

    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.

  2. Adrian
    Member
    Posted 1 year ago #

    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?

  3. Ged_CY
    Member
    Posted 1 year ago #

    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.

  4. Adrian
    Member
    Posted 1 year ago #

  5. Ged_CY
    Member
    Posted 1 year ago #

    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

  6. Adrian
    Member
    Posted 1 year ago #

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

  7. Ged_CY
    Member
    Posted 1 year ago #

    Same error, could it be hacked?

  8. Adrian
    Member
    Posted 1 year ago #

    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.

  9. Ged_CY
    Member
    Posted 1 year ago #

    I can't access the dashboard at all

  10. Adrian
    Member
    Posted 1 year ago #

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

  11. Ged_CY
    Member
    Posted 1 year ago #

    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

  12. peppiedegekste
    Member
    Posted 10 months ago #

    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

  13. peppiedegekste
    Member
    Posted 10 months ago #

    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

  14. peppiedegekste
    Member
    Posted 10 months ago #

    I DID IT !

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

    Thanks for 'listening' :)))))

Topic Closed

This topic has been closed to new replies.

About this Topic