bonjour,
Sur ma page single j'ai cette erreur :
Warning: current() [function.current]: Passed variable is not an array or object in single.php
auriez vous une idée?
Voici le code de ma page single :
<?php get_header(); ?>
<div id="content-single">
<?php get_sidebar(); ?>
<div id="single">
<div class="banactus"></div>
<div class="content-news-single">
<?php if(have_posts()): while(have_posts()): the_post(); ?>
<?php
$image_id = get_post_thumbnail_id();
$image_url = current(wp_get_attachment_image_src($image_id,'full'));
?>
<a href="<?php echo $image_url; ?>"><?php the_post_thumbnail(); ?></a>
<div class="single-news">
<h1><?php the_title(); ?></h1>
<h5 class="date">Posté le <span><?php the_time('d F Y'); ?></span></h5>
<?php the_content(); ?>
</div>
<?php endwhile; endif; ?>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
merci
Remplace cette ligne:
$image_url = current(wp_get_attachment_image_src($image_id,'full'));
par ces ligne :
if (!empty($image_url[0]))
$image_url = $image_url[0];
else
$image_url = '';