Selamlar,
Bi kod satırında bu hatayı alıyorum.
PHP Warning: Illegal string offset 'target' in /home/*******/public_html/wp-content/themes/*******/singleTable.php on line 52
52. Satırda yer alan kod bu:
$link_target = $urunaile[$i]['target'] ? $link['target'] : '_self';
Kodun tamamı
<?php
$urunaile = [];
$urunailewidth = 'calc(33% - 5px)';
for($i=0;$i<6;$i++){
$link = get_field('urun_ailesi'.$i);
if($link)
array_push($urunaile,$link);
}
if(!empty($urunaile)){
if(count($urunaile) > 3)$urunailewidth ='calc(25% - 5px)';
echo '<div class="urun-container">';
for($i=0;$i<count($urunaile);$i++){
?>
<div class="urunaile_card" style="width: <?= $urunailewidth?>; ">
<?php
$image = get_field('resim_url');
$link_url = $urunaile[$i]['url'];
$link_title = $urunaile[$i]['title'];
$link_target = $urunaile[$i]['target'] ? $link['target'] : '_self';
echo "<img src='$image'>"; ?>
<a class="button" href="<?php echo esc_url( $link_url ); ?>" target="<?php echo esc_attr( $link_target ); ?>">
<?php echo esc_html( $link_title ); ?>
</a>
</div>
<?php
}
echo '</div>';
}
?>
<?php endif; ?>Yardımcı olabilirseniz seviririm.
Teşekkürler