• Hello all

    I was wondering if there is anyone who can help me. I made a big mistake playing with functions.php and maybe header.php theme files. Now my website is down, displaying only error: Parse error: syntax error, unexpected ‘<‘ in /home/lampgov/public_html/wp-content/themes/lamp/functions.php on line 118

    I tried to upload original functions.php and header.php files from the Theme to FTP, but no luck. I can’t login neither can view the site.

    Only acces I now have is the FTP.

    Any advice would be much appreciated?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    I tried to upload original functions.php and header.php files from the Theme to FTP, but no luck. I can’t login neither can view the site.

    Try downloading your theme from the server and replacing it with a fresh copy by using FTP or whatever file management application your host provides.

    Also try:
    resetting the plugins folder by using FTP or whatever file management application your host provides. Sometimes, an apparently inactive plugin can still cause problems.

    – switching to the default theme (twenty eleven) by renaming your current theme’s folder in wp-content/themes using FTP or whatever file management application your host provides.

    Thread Starter picking_functions

    (@picking_functions)

    Thank you for your reply. I have tried both of solutions, but still no luck. Nothing changes.

    Here is the code of the functions.php file in question:

    <?php
    /* Load the tfuse class. */
    require_once( TEMPLATEPATH . '/library/tfuse.php' );
    
    /* Initialize the tfuse framework. */
    $tfuse = new tfuse();
    $tfuse->init();
    
    define( 'PREFIX', $tfuse->prefix );
    
    @$style = $_GET['color'];
    
    $styles_directory = get_template_directory()."/styles/";
    $styles_directory_uri = get_template_directory_uri()."/styles/";
    
    if( is_file( $styles_directory . $style .'.css' ) ) { 
    
    	//update_option(PREFIX.'_alt_stylesheet',$style.".css");
    	setcookie(PREFIX . '_style_demo', $style.".css", time()+3600, '/');
    }
    
    if( !empty($_GET['bg']) && is_file( get_template_directory().'/images/'.esc_attr($_GET['bg']) ) )
    {
        @setcookie(PREFIX . '_style_demo', esc_attr($_GET['bg']), time()+3600*60, '/');
    }
    # This sets the HTML Editor as default #
    add_filter( 'wp_default_editor', create_function('', 'return "html";') );
    
    add_filter('themefuse_shortcodes', 'do_shortcode');
    add_filter('widget_text', 'do_shortcode');
    
    //add_theme_support( 'post-thumbnails' );
    
    // Disable Admin Bar for all users
    add_filter('show_admin_bar', '__return_false');
    
    function improved_trim_excerpt($text) {
    	$raw_excerpt = $text;
    	if ( '' == $text ) {
    		$text = get_the_content('');
    
    		$text = strip_shortcodes( $text );
    
    		$text = apply_filters('the_content', $text);
    		$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
    		$text = str_replace(']]>', ']]>', $text);
    		$text = strip_tags($text, '<a>');
    		$excerpt_length = apply_filters('excerpt_length', 25);
    		$excerpt_more = apply_filters('excerpt_more', ' ...' . '');
    		$words = explode(' ', $text, $excerpt_length + 1);
    		if (count($words) > $excerpt_length) {
    			array_pop($words);
    			$text = implode(' ', $words);
    			$text = $text . $excerpt_more;
    		}
    	}
    	return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }
    
    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'improved_trim_excerpt');
    
    $_settings = get_option('newsletter_settings') ? get_option('newsletter_settings') : array();
    
    function add_email( $email ){
    
    	global $_settings;
    
    	$emails = explode(",", $email);
    	$valid_emails = array();
    	$unique_emails = array();
    
    	foreach($emails as $mail){
    		if ( is_email(trim($mail)) ) $valid_emails[] = trim($mail);
    	}
    
    	if ( empty($valid_emails) ) return false;
    
    	$valid_emails_string = implode(",", $valid_emails);
    	if ( !empty($_settings['newsletter_emails']) ) $valid_emails_string = ',' . $valid_emails_string;
    
    	$_settings['newsletter_emails'] .= $valid_emails_string;
    	$unique_emails = explode(",", $_settings['newsletter_emails']);
    	$unique_emails = array_unique($unique_emails);
    
    	$_settings['newsletter_emails'] = implode(",", $unique_emails);
    	_save_settings_todb();
    
    	return true;
    }
    
    function _save_settings_todb($form_settings = '')
    {
    	global $_settings;
    
    	if ( $form_settings <> '' ) {
    		unset($form_settings['newsletter_settings_saved']);
    
    		$emails = $_settings['newsletter_emails'];
    
    		$_settings = $form_settings;
    		$_settings['newsletter_emails'] = $emails;
    	}
    	update_option('newsletter_settings', $_settings);
    }
    
    if ( isset($_POST['newsletter']) ) add_email( $_POST['newsletter'] );
    
    if (!function_exists('tfuse_comment_reply')) {
    	function tfuse_comment_reply() {
    		if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
    	}
    }
    add_action('get_header', 'tfuse_comment_reply');
    
    ?>
    Moderator keesiemeijer

    (@keesiemeijer)

    Can we have a link to your site?

    Thread Starter picking_functions

    (@picking_functions)

    Moderator keesiemeijer

    (@keesiemeijer)

    I think you’re still using the lamp theme.
    Have you tried?

    – switching to the default theme by renaming your current theme’s folder (lamp) in wp-content/themes using FTP or whatever file management application your host provides.

    Thread Starter picking_functions

    (@picking_functions)

    I have renamed “twentyeleven” folder in “lamp” and thigs are the same.
    I have renamed “lamp” in “twentyeleven”, still the same. Even now I don’t have a “lamp” folder name. Check it out? Whatever I try, still get the same parse error..

    Thread Starter picking_functions

    (@picking_functions)

    And yes, uploading fresh copy of the theme and replacing those files, didn’t help either. I thought it would recover it, whatever it may be. Very strange..

    Moderator keesiemeijer

    (@keesiemeijer)

    I have renamed “twentyeleven” folder in “lamp” and things are the same.

    Don’t rename the twentyeleven theme folder, you only need to rename the lamp folder.

    Thread Starter picking_functions

    (@picking_functions)

    It is renamed, and “twentyeleven” is still there.

    Thread Starter picking_functions

    (@picking_functions)

    I have managed to solve this. Simply by trying to upload and replace corrupted functions.php file again…

    Thank you very much for your support, keesiemeijer!

    Moderator keesiemeijer

    (@keesiemeijer)

    That’s strange because I can still see it here as part of the url.
    http://www.lamp.gov.me/wp-content/themes/lamp/style.css

    Moderator keesiemeijer

    (@keesiemeijer)

    Ah, that would explain it. 🙂

    I’m glad you got it solved.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘I was playing with functions.php’ is closed to new replies.