@lackoi

Почему выдаёт ошибку?

Перенёс сайт через дубликатор на локалку. Вот такая ошибка5bc5d9c738ae4881492557.png. кусок кода в котором ошибка5bc5d9e812641036571185.png. Весь код на всякий случай
<?php register_nav_menus(
array(
'primary'=>__('menu'),
)
);
add_action( 'init', 'create_news' );
function create_news() {
$labels = array(
'name' => _x('Новости', 'post type general name'),
'singular_name' => _x('Новость', 'post type singular name'),
'add_new' => _x('Добавить новость', 'news'),
'add_new_item' => __('Добавить новость'),
'edit_item' => __('Редактировать новость'),
'new_item' => __('Добавить новость'),
'view_item' => __('Посмотреть новость'),
'search_items' => __('Search news'),
'not_found' => __('No news found'),
'not_found_in_trash' => __('No news found in Trash'),
'parent_item_colon' => ''
);
$supports = array('title', 'editor');
register_post_type( 'news',
array(
'labels' => $labels,
'public' => true,
'supports' => $supports,

'rewrite' => array('slug' => 'news-item'),
)
);
}
add_action( 'init', 'create_portfolio' );
function create_portfolio() {
$labels = array(
'name' => _x('Портфолио', 'post type general name'),
'singular_name' => _x('Работу', 'post type singular name'),
'add_new' => _x('Добавить работу', 'portfolio'),
'add_new_item' => __('Добавить работу'),
'edit_item' => __('Редактировать работу'),
'new_item' => __('Добавить работу'),
'view_item' => __('Посмотреть работу'),
'search_items' => __('Search portfolio'),
'not_found' => __('No portfolio found'),
'not_found_in_trash' => __('No portfolio found in Trash'),
'parent_item_colon' => ''
);
$supports = array('title', 'editor');
register_post_type( 'portfolio',
array(
'labels' => $labels,
'public' => true,
'supports' => $supports,

'rewrite' => array('slug' => 'portfolio-item'),
)
);
}
add_action( 'init', 'create_services' );
function create_services() {
$labels = array(
'name' => _x('Услуги', 'post type general name'),
'singular_name' => _x('Услугу', 'post type singular name'),
'add_new' => _x('Добавить услугу', 'services'),
'add_new_item' => __('Добавить услугу'),
'edit_item' => __('Редактировать услугу'),
'new_item' => __('Добавить услугу'),
'view_item' => __('Посмотреть услугу'),
'search_items' => __('Search services'),
'not_found' => __('No services found'),
'not_found_in_trash' => __('No services found in Trash'),
'parent_item_colon' => ''
);
$supports = array('title', 'editor');
register_post_type( 'services',
array(
'labels' => $labels,
'public' => true,
'supports' => $supports,

'rewrite' => array('slug' => 'services-item'),
)
);
}
add_filter('nav_menu_css_class', 'add_active_class', 10, 2 );
function add_active_class($classes, $item, $args) {
if( in_array( 'current-menu-item', $classes ) ||
in_array( 'current-menu-ancestor', $classes ) ||
in_array( 'current-menu-parent', $classes ) ||
in_array( 'current-page-parent', $classes ) ||
in_array( 'current-page-ancestor', $classes )
) {
$classes[] = "active";
}

return $classes;
}
function custom_gallery_grid($output = '', $attrs, $instance) {
$attrs = array_merge(array('columns' => 3), $attrs);
// echo '' . print_r($attrs, true) . ''; // Check what is inside the array.
$columns = $attrs['columns'];
$images = explode(',', $attrs['ids']);
// Other columns options in WordPress gallery (5,7,8,9)
// are not suitable for default Bootstrap 12 columns grid
// so they take the default value `col-sm-4`.
switch($columns) {
case 1:
$col_class = 'col-sm-12';
break;
case 2:
$col_class = 'col-sm-6';
break;
// case 3: # Default
// $col_class = 'col-sm-4';
// break;
case 4:
$col_class = 'col-sm-3';
break;
case 6:
$col_class = 'col-sm-2';
break;
default:
$col_class = 'col-sm-4';
break;
}
// Gallery thumnbnail size (set via WordPress gallery panel).
// Defaults to `thumbnail` size.
$galleryThumbSize = ($attrs['size']) ? $attrs['size'] : 'thumbnail';
// Starting `gallery` block and first gallery `row`.
$galleryID = ($instance < 10) ? 'gallery-0' . $instance : 'gallery-' . $instance;
$gallery = '

';
$i = 0; // Counter for the loop.
foreach ($images as $imageID) {
if ($i%$columns == 0 && $i > 0) { // Closing previous `row` and startin the next one.
$gallery .= '';
}
// Thumbnail `src` and `alt` attributes.
$galleryThumbSrc = wp_get_attachment_image_src($imageID, $galleryThumbSize);
$galleryThumbAlt = get_post_meta($imageID, '_wp_attachment_image_alt', true);
// Determine where to the gallery thumbnail is linking (set via WordPress gallery panel).
switch($attrs['link']) {
case 'file':
$galleryThumbLinkImg = wp_get_attachment_image_src($imageID, 'large'); // Take the `full` or `large` image url.
$galleryThumbLinkAttrs = array( // More attributes can be added, only `href` is required.
'href' => $galleryThumbLinkImg[0], // Link to original image file.
'data-gallery' => 'gallery', // Set some data-attribute if it is needed.
'target' => '_blank', // Set target to open in new tab/window.
// 'title' => '',
// 'class' => '',
// 'id' => ''
);
break;
case 'none':
$galleryThumbLinkAttrs = false;
break;
default: // By default there is no `link` and the thumb is linking to attachment page.
$galleryThumbLinkAttrs = array( // More attributes can be added, only `href` is required.
'href' => get_attachment_link($imageID), // Link to image file attachment page.
// 'title' => '',
// 'class' => '',
// 'id' => ''
);
break;
}
$gallery .= '
' .
custom_gallery_item($galleryThumbSrc[0], $galleryThumbAlt, $galleryThumbLinkAttrs) .
'';
$i++;
}
// Closing last gallery `row` and whole `gallery` block.
$gallery .= '

';
return $gallery;
}
// Helper function: DRY while generating gallery items.
function custom_gallery_item($itemImgSrc, $itemImgAlt = '', $itemLinkAttrs = false) {
$galleryItem = ''%20.%20$itemImgSrc%20.%20'';
if ($itemLinkAttrs) {
$linkAttrs = '';
foreach ($itemLinkAttrs as $attrName => $attrVal) {
$linkAttrs .= ' ' . $attrName . '="' . $attrVal . '"';
}
$galleryItem = '' . $galleryItem . '';
}
return $galleryItem;
}
add_filter( 'post_gallery', 'custom_gallery_grid', 10, 3 );

add_image_size ('portfolio', 293, 243, true);
add_image_size ('portfolio_min', 137, 115, true);
add_image_size ('prim', 300, 217, true);
add_image_size ('services_min', 208, 204, true);
add_image_size ('services', 460, 9999);
add_image_size ('services_slide', 221, 250, true);
add_image_size ('news', 254, 248, true);
add_image_size ('slide', 1920, 620, true);
add_image_size ('home_about', 245, 9999);
add_image_size ('home_partner', 185, 9999);
add_image_size ('logo', 205, 9999);
add_action('admin_head', 'moi_novii_style');
function moi_novii_style() {
print '';
}
function my_acf_options_page_settings ( $settings )
{
global $user_ID;

$values = get_field('vybor_polzovatelej_dlya_redaktirovaniya_slajdera', $option);


if ( $user_ID ==$values[0]['ID'] || $user_ID ==$values[1]['ID'] || $user_ID ==$values[2]['ID'] || $user_ID ==$values[3]['ID'] || $user_ID ==$values[4]['ID'] || $user_ID ==$values[5]['ID'] || $user_ID ==$values[6]['ID'] || $user_ID ==$values[7]['ID'] || $user_ID ==$values[8]['ID'] || $user_ID ==$values[9]['ID'] || $user_ID ==$values[10]['ID']) {
$settings['pages'] = array('Слайдер');
} else {
$settings['pages'] = array('Шапка', 'Подвал', 'Email');

}

return $settings;



}

add_filter('acf/options_page/settings', 'my_acf_options_page_settings');

if( function_exists('acf_set_options_page_title') )
{

acf_set_options_page_title( __('Шапка и подвал') );

}
function custom_menu_order( $menu_ord ) {
if (!$menu_ord) return true;
$menu = 'acf-options-shapka';
$menu_ord = array_diff($menu_ord, array( $menu ));
array_splice( $menu_ord,8, 0, array( $menu ) );
return $menu_ord;
}

add_filter('custom_menu_order', 'custom_menu_order');
add_filter('menu_order', 'custom_menu_order');
function edit_admin_menus() {
global $menu;
global $submenu;

remove_menu_page('edit-comments.php');
remove_menu_page('edit.php');

}
add_action( 'admin_menu', 'edit_admin_menus' );

function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
  • Вопрос задан
  • 36 просмотров
Решения вопроса 1
wayheming
@wayheming
add_filter('nav_menu_css_class', 'add_active_class', 10, 3 ); Замените свою строчку
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы