Cette question me rend fou depuis des semaines: ((Aidez-moi s'il vous plaît.
Les commentaires sont attribués à des articles liés et sont également visibles sur d’autres articles.
Par ex.
La page est redirigée vers "Sports" lorsque je poste le commentaire sur "Aliments". Le même commentaire est visible sur tous les autres articles tels que "Tours", "Actualités", etc.
Très probablement, le commentaire est attribué au dernier "message lié"
Pour être plus clair:
Page de sport | V Related Posts - Nouvelles, visites, nourriture
Maintenant, le commentaire va à la poste "Nourriture"
voici le code
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$image1 = get_post_meta(get_the_ID(), 'tz_upload_image', true);
$image2 = get_post_meta(get_the_ID(), 'tz_upload_image2', true);
$image3 = get_post_meta(get_the_ID(), 'tz_upload_image3', true);
$image4 = get_post_meta(get_the_ID(), 'tz_upload_image4', true);
$image5 = get_post_meta(get_the_ID(), 'tz_upload_image5', true);
$image6 = get_post_meta(get_the_ID(), 'tz_upload_image6', true);
$image7 = get_post_meta(get_the_ID(), 'tz_upload_image7', true);
$image8 = get_post_meta(get_the_ID(), 'tz_upload_image8', true);
$image9 = get_post_meta(get_the_ID(), 'tz_upload_image9', true);
$image10 = get_post_meta(get_the_ID(), 'tz_upload_image10', true);
$folder_name = get_post_meta(get_the_ID(), 'folder_name', true);
$product_name = get_post_meta(get_the_ID(), 'product_name', true);
$product_id = get_post_meta(get_the_ID(), 'product_id', true);
$comingSoonButton = "<img src='http://www.appdesignvault.com/images/site/comingsoon.png'/>";
$downloadButton = "<img src='http://www.appdesignvault.com/images/site/green-button/download-slash.png'/>";
$buyButtonImage = "http://www.appdesignvault.com/images/site/red-button/buy-this-theme-slash.png";
if($product_id == 22)
{
$buyButtonImage = "http://www.appdesignvault.com/images/site/buy-now-49.png";
}
$themeLinkNoMember = '<form name="PaymentForm" method="post" action="http://www.appdesignvault.com/dap/paypalCoupon.php">
<input type="hidden" name="cmd" value="_xclick"/>
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="item_name" value="'.$product_name.'" />
<div><input class="trans" type="image" src="'. $buyButtonImage. '" border="0" name="submit" alt="Make payments with Paypal - its fast, free and secure!" /></div>
</form>';
$themeLink = '<a href="http://www.appdesignvault.com/wp-content/uploads/' .$folder_name. '/themep.Zip">'.$downloadButton.'</a>';
$accessText = 'userhasccess';
$accessShortCode = '[DAP hasAccessTo="'. $product_id .'"]'.$accessText.'[/DAP]';
$attributes = array('isloggedin' => 'Y', 'errmsgtemplate' => 'Log in or Join');
if($product_id == 0)
{
$dlLink = $comingSoonButton;
}
else
{
$accessContent = dap_shortcode($attributes, $accessShortCode);
if(strpos($accessContent, $accessText) == true)
{
$dlLink = $themeLink;
}
else
{
$dlLink = $themeLinkNoMember;
}
}
?>
<!--BEGIN #portfolio-post-wrap -->
<div id="portfolio-post-wrap" class="clearfix">
<!--BEGIN .portfolio-sidebar -->
<div class="portfolio-sidebar">
<!--<h2 class="portfolio-title">the_title();</h2>-->
<!--BEGIN .entry-content -->
<div>
<?php
echo $dlLink;
?>
<!--END .entry-content -->
</div>
<?php $terms = get_the_terms( get_the_ID(), 'skill-type' ); ?>
<?php $product_price = $product_id == 22 ? '$49' : '$70'; ?>
<?php if ($product_id == 22){ echo "<p>Offer ends: 12th Jan 2012. </p>" ;} ?>
<div class="clear"></div>
<div class="callout_box">
<div class="theme-price">
<span class="theme-price"><?php echo $product_price; ?></span>
</div>
</div>
<div class="callout_box"><h4><strong><?php _e('Features:', 'framework'); ?></strong></h4>
<div class="inner">
<ul class="tax-list clearfix">
<li><span><img align="left" src="http://www.appdesignvault.com/images/site/xcode.png"> Sample Project</span></li>
<li><span><img align="left" src="http://www.appdesignvault.com/images/site/magnify.png"> Retina (@2x) files</span></li>
<li><span><img align="left" src="http://www.appdesignvault.com/images/site/xcode.png"> iOS 5 compatible</span></li>
<li><span><img align="left" src="http://www.appdesignvault.com/images/site/photoshop.png"> .PSD files</span></li>
<li><span><img align="left" src="http://www.appdesignvault.com/images/site/design.png"> PNG Artwork</span></li>
</ul>
</div>
</div>
<div class="callout_box"><h4><strong><?php _e('Vault Tags:', 'framework'); ?></strong></h4>
<div class="inner">
<ul class="tax-list clearfix">
<?php foreach ($terms as $term) : ?>
<li><span><?php echo $term->name; ?></span></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<div>
<?php if(0){ ?>
<?php if(function_exists('dd_digg_generate')){dd_google1_generate('Normal');} ?>
<?php if(function_exists('dd_digg_generate')){dd_Twitter_generate('Normal','emityme');} ?>
<?php if(function_exists('dd_digg_generate')){dd_fblike_generate('Like Box Count');} ?>
<?php if(function_exists('dd_digg_generate')){dd_digg_generate('Normal');} ?>
<?php }?>
</div>
<!--END .portfolio-sidebar -->
</div>
<!--BEGIN #portfolio-wrap -->
<div id="portfolio-wrap">
<!--BEGIN .hentry -->
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<?php
$add_info = get_post_meta(get_the_ID(), 'tz_additional_info', true);
$video_url = get_post_meta(get_the_ID(), 'tz_video_url', true);
$embeded_code = get_post_meta(get_the_ID(), 'tz_embed_code', true);
?>
<?php if($video_url !='' || $embeded_code != '') : ?>
<!--BEGIN .video_slide -->
<div class="video_slide">
<?php if($add_info != '') : ?>
<!--BEGIN .video_info -->
<div class="video_info">
<?php echo stripslashes(htmlspecialchars_decode($add_info)); ?>
</div>
<!--END .video_info -->
<?php endif; ?>
<!--BEGIN .post_video -->
<div class="post_video">
<?php tz_video(get_the_ID()); ?>
<!--END .post_video -->
</div>
<!--END .video_slide -->
</div>
<?php endif; ?>
<?php if(get_post_meta(get_the_ID(), 'tz_portfolio_enable_slider', true) == 'yes') : ?>
<!--BEGIN #portfolio-slider .clearfix -->
<div id="portfolio-slider" class="clearfix">
<!--BEGIN .slides_container -->
<div class="slides_container">
<?php
if($image1 != '') :
$height = get_post_meta(get_the_ID(), 'tz_image1_height', true);
if($height == '') :
$height = getimagesize($image1);
$height = $height[1];
endif;
endif;
?>
<div><img width="696" height="<?php echo $height; ?>" src="<?php echo $image1; ?>" alt="<?php the_title(); ?>"></div>
<?php if($image2 != '') : ?>
<div><img width="696" src="<?php echo $image2; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image3 != '') : ?>
<div><img width="696" src="<?php echo $image3; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image4 != '') : ?>
<div><img width="696" src="<?php echo $image4; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image5 != '') : ?>
<div><img width="696" src="<?php echo $image5; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image6 != '') : ?>
<div><img width="696" src="<?php echo $image6; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image7 != '') : ?>
<div><img width="696" src="<?php echo $image7; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image8 != '') : ?>
<div><img width="696" src="<?php echo $image8; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image9 != '') : ?>
<div><img width="696" src="<?php echo $image9; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image10 != '') : ?>
<div><img width="696" src="<?php echo $image10; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<!--END .slides_container -->
</div>
<?php if($image2 != '' && get_post_meta(get_the_ID(), 'tz_portfolio_enable_slider', true) == 'yes') : ?>
<div id="line_wrap">
<div id="line"></div>
</div><!--line_wrap-->
<div id="portfolio_nav">
<div id="circles">
<!--BEGIN .pagination -->
<ul class="pagination">
<?php if($image2 != '') : ?>
<li><a href="#"></a></li>
<li><a href="#"></a></li>
<?php endif; ?>
<?php if($image3 != '') : ?>
<li><a href="#"></a></li>
<?php endif; ?>
<?php if($image4 != '') : ?>
<li><a href="#"></a></li>
<?php endif; ?>
<?php if($image5 != '') : ?>
<li><a href="#"></a></li>
<?php endif; ?>
<?php if($image6 != '') : ?>
<li><a href="#"></a></li>
<?php endif; ?>
<?php if($image7 != '') : ?>
<li><a href="#"></a></li>
<?php endif; ?>
<?php if($image8 != '') : ?>
<li><a href="#"></a></li>
<?php endif; ?>
<?php if($image9 != '') : ?>
<li><a href="#"></a></li>
<?php endif; ?>
<?php if($image10 != '') : ?>
<li><a href="#"></a></li>
<?php endif; ?>
<!--END .pagination -->
</ul>
</div><!--circles-->
<div id="arrows">
<div id="left_arrow"><a class="prev" href="#">previous</a></div>
<div id="right_arrow"><a class="next" href="#">next</a></div>
</div><!--arrows-->
</div><!--portfolio_nav-->
<?php endif; ?>
<!--END #portfolio-slider -->
</div>
<?php else: ?>
<?php
if($image1 != '') : ?>
<div><img width="696" src="<?php echo $image1; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image2 != '') : ?>
<div><img width="696" src="<?php echo $image2; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image3 != '') : ?>
<div><img width="696" src="<?php echo $image3; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image4 != '') : ?>
<div><img width="696" src="<?php echo $image4; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image5 != '') : ?>
<div><img width="696" src="<?php echo $image5; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image6 != '') : ?>
<div><img width="696" src="<?php echo $image6; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image7 != '') : ?>
<div><img width="696" src="<?php echo $image7; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image8 != '') : ?>
<div><img width="696" src="<?php echo $image8; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image9 != '') : ?>
<div><img width="696" src="<?php echo $image9; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php if($image20 != '') : ?>
<div><img width="696" src="<?php echo $image10; ?>" alt="<?php the_title(); ?>"></div>
<?php endif; ?>
<?php endif; ?>
<!--END .hentry-->
</div>
<div id="portfolio-info" class="clearfix">
<?php the_content(); ?>
</div>
<!--END #portfolio-wrap-->
</div>
<!--END #portfolio-post-wrap -->
</div>
<hr>
<!--BEGIN .portfolio-related -->
<div id="portfolio-related" class="clearfix">
<!--BEGIN .portfolio-sidebar -->
<div class="portfolio-sidebar">
<h2 class="entry-title"><?php echo stripslashes(get_option('tz_related_portfolio_title')); ?></h2>
<!--BEGIN .entry-content -->
<div class="entry-content">
<?php echo stripslashes(get_option('tz_related_portfolio_description')); ?>
<!--END .entry-content -->
</div>
<!--END .portfolio-sidebar -->
</div>
<!--BEGIN #related-wrap -->
<div id="related-wrap">
<!--BEGIN #columns-wrap-->
<ul id="columns-wrap" class="image-grid-three">
<?php global $post;
$postId = $post->ID;
$query = get_posts_related_by_taxonomy($post->ID, 'skill-type');?>
<?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
$terms = get_the_terms( get_the_ID(), 'skill-type' ); ?>
<?php if(get_the_ID() != $postId) : ?>
<li>
<!--BEGIN .hentry -->
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<?php /* if the post has a WP 2.9+ Thumbnail */
if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?>
<div class="post-thumb">
<?php tz_lightbox(get_the_ID(), TRUE); ?>
</div>
<?php } ?>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'framework'), get_the_title()); ?>"> <?php the_title(); ?></a> <?php edit_post_link( __('edit', 'framework'), '<span class="edit-post">[', ']</span>' ); ?></h2>
<!--BEGIN .entry-content -->
<div class="entry-content">
<?php /*the_excerpt();*/ ?>
<a href="<?php the_permalink(); ?>" class="more-link"><?php _e('Read more...', 'framework'); ?></a>
<!--END .entry-content -->
</div>
<!--END .hentry-->
</div>
</li>
<?php endif; ?>
<?php endwhile; endif; ?>
<!--END #columns-wrap-->
</ul>
<!--END #related-wrap -->
</div>
<!--END #portfolio-related -->
</div>
<?php comments_template('', true); ?>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
Merci beaucoup d'avance :-)
essayez d'ajouter wp_reset_postdata();
après le endwhile;
de la boucle 'related posts'.