Плагины все отключал. Ошибка остается. На счет лишнего пробела не знаю, даже если он и есть, я не смогу определить где он.
<?php
add_action('wp_enqueue_scripts', 'sprosiservis_css');
function sprosiservis_css () {
wp_enqueue_style('style', get_template_directory_uri() . '/css/style.css', array(), '1.0.0');
wp_enqueue_style('page-doc', get_template_directory_uri() . '/css/page-doc.css', array(), '1.0.0');
wp_enqueue_style('single', get_template_directory_uri() . '/css/single.css', array(), '1.0.0');
wp_enqueue_style('google-fonts', '//fonts.googleapis.com/css?family=PT+Serif:400,400i,700|Ubuntu:300', array(), '1.0.0');
}
add_action('admin_head', 'custom_styles');
function custom_styles() { echo '<style type="text/css">#menu-posts,#menu-comments,#toplevel_page_cptui_main_menu,#toplevel_page_edit-post_type-acf,#toplevel_page_acf-options{display:none !important}</style>'; }
add_image_size('consultations', 90, 90, false);
add_image_size('services', 243, 243, true);
add_image_size('news', 248, 150, true);
add_image_size('maintop', 534, 300, false);
add_image_size('main', 329, 400, false);
add_image_size('dost', 125, 88, false);
add_image_size('avatar', 97, 97, true);
add_theme_support('menus');
register_nav_menus(array(
'main-menu' => 'Главное меню',
'bottom-menu' => 'Нижнее меню'
));
remove_action( 'add_option_new_admin_email', 'update_option_new_admin_email' );
remove_action( 'update_option_new_admin_email', 'update_option_new_admin_email' );
function wpdocs_update_option_new_admin_email( $old_value, $value ) {
update_option( 'admin_email', $value );
}
include("js/acf-options-page/acf-options-page.php");
add_action( 'add_option_new_admin_email', 'wpdocs_update_option_new_admin_email', 10, 2 );
add_action( 'update_option_new_admin_email', 'wpdocs_update_option_new_admin_email', 10, 2 );
function cut_string($string, $length = 95){
if ($length && strlen($string) > $length){
$str = strip_tags($string);
$str = substr($str, 0, $length);
$pos = strrpos($str, ' ');
return (substr($str, 0, $pos)).'…';
}
return $string;
}
include("js/acf-repeater/acf-repeater.php");
class multipartmail{
var $header;
var $parts;
var $message;
var $subject;
var $to_address;
var $boundary;
function multipartmail($dest, $src, $sub){
$this->to_address = $dest;
$this->subject = $sub;
$this->parts = array("");
$this->boundary = "--" . md5(uniqid(time()));
$this->header = "From: $src\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed; " .
" boundary=\"" . $this->boundary . "\"\r\n" .
"X-Mailer: PHP/" . phpversion();
}
function addmessage($msg = "", $ctype = "text/plain"){
$this->parts[0] = "Content-Type: $ctype; charset=UTF-8\r\n" .
"Content-Transfer-Encoding: 7bit\r\n" .
"\n" .$msg."\r\n";
}
function addattachment($file, $ctype){
$fname = substr(strrchr($file, "\\"), 1);
$data = file_get_contents($file);
$i = count($this->parts);
$content_id = "part$i." . sprintf("%09d", crc32($fname)) . strrchr($this->to_address, "@");
$this->parts[$i] = "Content-Type: $ctype; name=\"$fname\"\r\n" .
"Content-Transfer-Encoding: base64\r\n" .
"Content-ID: <$content_id>\r\n" .
"Content-Disposition: attachment; " .
" filename=\"$fname\"\r\n" .
"\n" .
chunk_split( base64_encode($data), 68, "\n");
return $content_id;
}
function buildmessage(){
$this->message = "This is a multipart message in mime format.\n";
$cnt = count($this->parts);
for($i=0; $i<$cnt; $i++){
$this->message .= "--" . $this->boundary . "\n" .
$this->parts[$i];
}
}
function getmessage(){
$this->buildmessage();
return $this->message;
}
function sendmail(){
$this->buildmessage();
mail($this->to_address, $this->subject, $this->message, $this->header);
}
}
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array('page_title' => __("Дополнительно"),'menu_title' => __("Дополнительно"),'menu_slug' => 'params','post_id' => 'params','update_button' => 'Обновить','updated_message' => 'Обновлено'));
}
add_action( 'show_user_profile', 'add_extra_social_links' );
add_action( 'edit_user_profile', 'add_extra_social_links' );
function add_extra_social_links($user) { ?>
<h3>Дополнительные данные</h3>
<table class="form-table">
<tr>
<th><label for="user_patronymic">Отчество</label></th>
<td><input type="text" name="user_patronymic" value="<?php echo esc_attr(get_the_author_meta( 'user_patronymic', $user->ID )); ?>" class="regular-text" /></td>
</tr>
<tr>
<th><label for="user_sex">Пол</label></th>
<td><select name="user_sex" class="regular-text">
<option value="" disabled<?php if(esc_attr(get_the_author_meta( 'user_sex', $user->ID ))=="") { echo ' selected'; } ?>>Ваш пол</option>
<option value="m"<?php if(esc_attr(get_the_author_meta( 'user_sex', $user->ID ))=="m") { echo ' selected'; } ?>>Мужской</option>
<option value="w"<?php if(esc_attr(get_the_author_meta( 'user_sex', $user->ID ))=="w") { echo ' selected'; } ?>>Женский</option>
</select></td>
</tr>
<tr>
<th><label for="user_birthday">День рождения</label></th>
<td><input type="text" name="user_birthday" value="<?php echo esc_attr(get_the_author_meta( 'user_birthday', $user->ID )); ?>" class="regular-text" /></td>
</tr>
<tr>
<th><label for="user_city">Ваш город</label></th>
<td><input type="text" name="user_city" value="<?php echo esc_attr(get_the_author_meta( 'user_city', $user->ID )); ?>" class="regular-text" /></td>
</tr>
<tr>
<th><label for="user_phone">Ваш телефон</label></th>
<td><input type="text" name="user_phone" value="<?php echo esc_attr(get_the_author_meta( 'user_phone', $user->ID )); ?>" class="regular-text" /></td>
</tr>
</table>
<?php }
add_action( 'personal_options_update', 'save_extra_social_links' );
add_action( 'edit_user_profile_update', 'save_extra_social_links' );
function save_extra_social_links( $user_id )
{
update_user_meta( $user_id,'user_patronymic', sanitize_text_field( $_POST['user_patronymic'] ) );
update_user_meta( $user_id,'user_sex', sanitize_text_field( $_POST['user_sex'] ) );
update_user_meta( $user_id,'user_birthday', sanitize_text_field( $_POST['user_birthday'] ) );
update_user_meta( $user_id,'user_city', sanitize_text_field( $_POST['user_city'] ) );
update_user_meta( $user_id,'user_phone', sanitize_text_field( $_POST['user_phone'] ) );
}
function post_published_notification( $ID, $post ) {
$blogusers = get_users();
foreach ($blogusers as $user) { if (get_the_author_meta( 'subscribe', $user->ID ) != "no") {
$mulmail = new multipartmail($user->user_email, "feedback@sprosiservis.pdnx.ru", "Новости сайта ".get_bloginfo("name"));
$mulmail->addmessage("Новое на сайте\nНазвание: ".get_the_title($ID)."\nСсылка: ".get_permalink($ID));
$mulmail->sendmail();
unset($mulmail);
} }
}
add_action( 'publish_consultations', 'post_published_notification', 10, 2 );
add_action( 'publish_news', 'post_published_notification', 10, 2 );
add_filter( 'deprecated_function_trigger_error', '__return_false' );