Please Help me How to fix "Parse error: syntax error, unexpected
-
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 1558How to fix it
When I look for the line
I find out that1558 <?php
How to fix it
it really bothers meP.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?
-
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.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?
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?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.
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
If that
<php?is the line in question, get rid of it.Bill Member
Thank you for your reply and your sharing.
I got it!
I post the new php here
Hope you can help me!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; }1632~1636 line
function avada_comment( $comment, $args, $depth ) { Avada_Template::comment_template( $comment, $args, $depth ); } function avada_set_post_filters( $query ) {Hello Bill member
You are really kind
I do hope to receive your reply!@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
He WPyogi
Thank you for your reply!Was about to say the same thing. Replace the functions file, and please use a child theme for your changes.
(Thanks, @wpyogi!)
The topic ‘Please Help me How to fix "Parse error: syntax error, unexpected’ is closed to new replies.