I developed a website using Wordpress on localhost and its OK when I uploaded it to online server using cpanel, everything went success but after upload, i am facing problem, error code is give below....
Parse error: syntax error, unexpected T_FUNCTION in /home/content/11/5033311/html/tarek/wp-content/themes/fruitsmile/inc/functions/close_site.php on line 10
and this is the code referred to in error....
<?php
// Close Website
function get_current_user_role() {
global $wp_roles;
$current_user = wp_get_current_user();
$roles = $current_user->roles;
$role = array_shift($roles);
return isset($wp_roles->role_names[$role]) ? translate_user_role($wp_roles->role_names[$role]) : false;
}
add_action('init', function() { << -------- THIS IS LINE 10
if (!in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
global $theme_options;
$site_status = $theme_options['status-switch'];
if (!is_admin()) {
if (get_current_user_role() != "Administrator") {
if ($site_status == '0') {
get_template_part('/inc/closed');
die;
}
}
}
}
});
I cross checked my php code several times, it is correct. my code any help will be appreciated ...