• 興育 黃

    (@hsing-yuifreedomcc)


    When I edit the function.php.
    My site shows that
    “Parse error: syntax error, unexpected ‘<‘ in /home2/ifreedom/public_html/wp-content/themes/Avada/functions.php on line 1558

    How to fix it

    When I look for the line
    I find out that

    1558 <?php

    How to fix it
    it really bothers me

    P.S.
    Before it happen, I have already used the WP-DB to back up the SQL
    Does it work for me to fix this problem?

Viewing 15 replies - 1 through 15 (of 20 total)
  • Bill

    (@chubbycrow)

    Make sure that line (1558) doesn’t have any spaces after the last letter of code.

    If you have a backup of that functions file, you can replace the bad one with the good one.

    Whenever you make changes like that, you should make them to a child theme so you don’t lose your changes when the theme gets updated.

    Make sure before 1558 php tag is closed with ?>
    I think you open a php tag “<?php” in previously opened php tag which is not yet closed.

    Thread Starter 興育 黃

    (@hsing-yuifreedomcc)

    Hi Bill Member thank you for your suggestion.
    I am confused about what you said.
    I think the problem is my
    I show you the cod
    Hope you can help me

    [corrupted code removed – use the code buttons]

    The problem is “Parse error: syntax error, unexpected ‘<‘ in /home2/public_html/wp-content/themes/Avada/functions.php on line 1558”

    Do you know how to fix it?

    WPyogi

    (@wpyogi)

    Thread Starter 興育 黃

    (@hsing-yuifreedomcc)

    The backup I used is the database, which is backed up by WP-DB
    Does it work for my “functions” to replace it with a new one?

    Bill

    (@chubbycrow)

    No, this is not in the database. Do you have a backup of your theme files? If not, you can download a fresh copy of the theme and replace the theme’s functions.php file on your server with the fresh copy.

    Alternatively, if you can still use your admin pages you can switch to the default WP theme (TwentyFifteen) and delete the Avada theme and re-install it. Then re-activate it. (You will lose any changes you’ve made to the theme. That’s why you need to use a child theme.)

    If you want to post your code here, please read the link that @wpyogi posted for you. We would need to see the section before the bad line, as well as the next several lines.

    Thread Starter 興育 黃

    (@hsing-yuifreedomcc)

    Hi Bill Member:
    thank you for your reply
    I really need your help
    the page shows
    Parse error: syntax error, unexpected ‘<‘ in /home2/public_html/wp-content/themes/Avada/functions.php on line 1558
    Could you help me?

    /**
     * Auto Updater Code
     */
    
    function avada_auto_updater() {
    	$smof_data = get_option( 'Avada_options' );
    
    	if( isset( $smof_data['tf_username'] ) && !empty( $smof_data['tf_username'] ) && isset( $smof_data['tf_api'] ) && !empty( $smof_data['tf_api'] ) && isset( $smof_data['tf_purchase_code'] ) && !empty( $smof_data['tf_purchase_code'] ) ) {
    		$theme_info = wp_get_theme();
    		if( $theme_info->parent_theme ) {
    			$template_dir =  basename( get_template_directory() );
    			$theme_info = wp_get_theme( $template_dir );
    		}
    
    		$name = $theme_info->get( 'Name' );
    		$slug = $theme_info->get_template();
    
    		require_once( get_template_directory() . '/framework/class-updater.php' );
    		$theme_update = new AvadaThemeUpdater( 'http://updates.theme-fusion.com/avada-theme.php', $name, $slug );
    	}
    }
    add_action( 'admin_init', 'avada_auto_updater' );
    
    /**
     * Layerslider API
     */
    function avada_layerslider_ready() {
    	if( class_exists('LS_Sources') ) {
    		LS_Sources::addSkins( get_template_directory().'/includes/ls-skins' );
    	}
    	if( defined( 'LS_PLUGIN_BASE' ) ) {
    		remove_action( 'after_plugin_row_' . LS_PLUGIN_BASE, 'layerslider_plugins_purchase_notice', 10, 3 );
    	}
    }
    add_action( 'layerslider_ready', 'avada_layerslider_ready' );
    
    <php?
    
    /* Options Framework */
    require_once( get_template_directory() . '/framework/admin/index.php' );
    
    /**
     * The main theme class
     * Any additional assets, objects etc should be included and instantiated from here.
     * This is a work in progress and part of a larger rewrite that will happen over time.
     */
    class Avada {
    
    	public $init;
    	public $social_icons;
    	public $sidebars;
    
    	/**
    	 * The class constructor
    	 */
    	public function __construct() {
    
    		global $smof_data;
    
    		// Avada initialization class
    		require_once( get_template_directory() . '/includes/class-avada-init.php' );
    		// Avada initialization class
    		require_once( get_template_directory() . '/includes/class-avada-sidebars.php' );
    		// Avada template class
    		require_once( get_template_directory() . '/includes/class-avada-template.php' );
    		// Social Icons
    		require_once( get_template_directory() . '/framework/class-social-icons.php' );
    		// Initialize the mega menu framework
    		if ( ! $smof_data['disable_megamenu'] ) {
    			require_once( get_template_directory() . '/framework/plugins/megamenu/mega-menu-framework.php' );
    		}

    The page shows

    Bill

    (@chubbycrow)

    If that <php? is the line in question, get rid of it.

    Thread Starter 興育 黃

    (@hsing-yuifreedomcc)

    Bill Member
    Thank you for your reply and your sharing.
    I got it!
    I post the new php here
    Hope you can help me!

    Thread Starter 興育 黃

    (@hsing-yuifreedomcc)

    Hi Bill Member
    Thank you for your reply soon
    I follow your order
    However the page shows that
    “Fatal error: Cannot redeclare avada_comment() (previously declared in /home2/ifreedom/public_html/wp-content/themes/Avada/functions.php:77) in /home2/ifreedom/public_html/wp-content/themes/Avada/functions.php on line 1634”

    on line 1634 shows }

    //define('WOOCOMMERCE_USE_CSS', false);
    
    // Content Width
    if( ! isset( $content_width ) ) {
    	$content_width = '669';
    }
    
    // How comments are displayed
    function avada_comment( $comment, $args, $depth ) {
    	Avada_Template::comment_template( $comment, $args, $depth );
    }
    
    function avada_set_post_filters( $query ) {
    	global $smof_data;
    
    	if( ( is_tax( 'portfolio_category' ) || is_tax( 'portfolio_skills' ) || is_tax( 'portfolio_tags') )
    		&& $query->is_main_query()
    	) {
    		$query->set( 'posts_per_page', $smof_data['portfolio_items'] );
    	}
    
    	return $query;
    }
    
    add_filter('pre_get_posts', 'avada_set_post_filters');
    
    add_filter('wp_get_attachment_link', 'avada_pretty');
    function avada_pretty($content) {
    	$content = preg_replace("/<a/","<a rel=\"prettyPhoto[postimages]\"",$content,1);
    	return $content;
    }
    Thread Starter 興育 黃

    (@hsing-yuifreedomcc)

    1632~1636 line

    function avada_comment( $comment, $args, $depth ) {
    	Avada_Template::comment_template( $comment, $args, $depth );
    }
    
    function avada_set_post_filters( $query ) {

    Thread Starter 興育 黃

    (@hsing-yuifreedomcc)

    Hello Bill member
    You are really kind
    I do hope to receive your reply!

    WPyogi

    (@wpyogi)

    @hsing-yu@ifreedom.cc– you need to download a new copy of the theme and replace that file. Or ask the developer of the theme for help – these forums do not have any way to support commercial themes –

    http://codex.wordpress.org/Forum_Welcome#Commercial_Products

    Thread Starter 興育 黃

    (@hsing-yuifreedomcc)

    He WPyogi
    Thank you for your reply!

    Bill

    (@chubbycrow)

    Was about to say the same thing. Replace the functions file, and please use a child theme for your changes.

    (Thanks, @wpyogi!)

Viewing 15 replies - 1 through 15 (of 20 total)

The topic ‘Please Help me How to fix "Parse error: syntax error, unexpected’ is closed to new replies.