У моего нового клиента есть сайт, который не обновлялся долгое время. Теперь версия PHP, версия WordPress и плагины обновлены, но элементы Portifolio теперь возвращают эту ошибку:
Скриншот:
Предупреждение: недопустимое смещение строки 'alt' в
/home/elite856/public_html/wp-content/themes/eliteled/functions.php на
линия 679
Предупреждение: недопустимое смещение строки 'url' в
/home/elite856/public_html/wp-content/themes/eliteled/functions.php на
линия 679
Это строка 679:
'<img src="'. $ob_img['url'] .'" class="capa" alt="'. $ob_img['alt'] .'" />'.
Это целая функция:
$portfolio = new WP_Query( $args );
if( $portfolio->have_posts() ){
while ( $portfolio->have_posts() ) { $portfolio->the_post();
$ob_img = get_field( 'imagem_de_capa' );
$allcats = get_the_category( get_the_ID() );
$cat = $allcats[0]->name;
$arrayData = array(
'id' => get_the_ID(),
'Titulo' => get_the_title(),
'cat' => $cat
);
//Criando arrayData com as informações do portfolio
if( have_rows('conteudo_do_portfolio') ){
while( have_rows('conteudo_do_portfolio') ){ the_row();
$tipo = get_field( 'tipo' );
if( $tipo == 'foto' ){
if( empty( $arrayData['imgs'] ) ){
$arrayData['imgs'][] = array(
'full' => $ob_img['original_image']['url'],
'thumb' => wp_get_attachment_image_src( $ob_img['id'], 'thumb_portfolio' )[0]
);
}
$idImg = get_sub_field('foto');
$arrayData['imgs'][] = array(
'full' => wp_get_attachment_image_src( $idImg, 'full' )[0],
'thumb' => wp_get_attachment_image_src( $idImg, 'thumb_portfolio' )[0]
);
}else{
$idVideo = youtube_video_id( get_sub_field('video') );
$arrayData['imgs'][] = array(
'full' => $idVideo,
'thumb' => "http://img.youtube.com/vi/{$idVideo}/0.jpg"
);
}
}
}
//'<li class="'. ( is_home() || is_front_page() ? 'item-home' : '' ) .'">'
$conteudo .= '<li>'.
'<img src="'. $ob_img['url'] .'" class="capa" alt="'. $ob_img['alt'] .'" />'.
'<div class="camada text-center">'.
'<a href="#" class="openModalPortfolio" data-tipo="'. get_field( 'tipo' ) .'" data-json=\''. json_encode( $arrayData ) .' \'\ >'.
//'<div class="'. ( is_home() || is_front_page() ? 'center-home' : 'center' ) .'">'.
'<div class="center">'.
//'<img src="/wp-content/themes/eliteled/images/expand'. ( is_home() || is_front_page() ? '' : '-red' ) .'.png" class="expand" />'.
'<img src="/wp-content/themes/eliteled/images/expand-red.png" class="expand" />'.
'<span class="titulo">'. ( strlen( get_the_title() ) > 60 ? substr( get_the_title(), 0, 60 ) . '...' : get_the_title() ) .'</span>'.
'<span class="cat">'. $cat .'</span>'.
'</div>'.
'</a>'.
'</div>'.
'<div class="camada camada-branca"></div>'.
'</li>';
}
}
Я читал, что это предупреждение раньше не печаталось так, как раньше до PHP 5.4, а также что это происходит потому, что он ожидал и массив. У меня немного навыков PHP, кто-нибудь может подсказать, что мне делать?