رفتن به مطلب

مشکل نظرات در ورد پرس


پست های پیشنهاد شده

سلام خدمت همه اساتید

من در حال طراحی یک قالب برای سایتم هست ولی با یه مشکل عجیب روبرو شدم

وقتی یک نظر در یک پست درج میشه در همه پست ها نمایش داده میشه ! هر کاری هم میکنم مشکل حل نمیشه

اینم کدی که برای comments.php استفاده کردم :


<?php if ($comments) : ?>
<?php foreach ($comments as $comment) : ?>

<div class="comment-box" id="comment-<?php comment_ID() ?>">
<div class="avatars floatright"><?php if(function_exists("get_avatar")) echo get_avatar( $comment, 51 ); ?></div>
<div class="comment-author"><?php comment_author_link() ?> در <?php comment_date('j F Y'); ?> گفته :</div>
<div class=""><?php comment_text() ?></div>
<div class="clear"></div>
</div>

<?php
/* Changes every other comment to a different class */
$oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
?>
<?php endforeach; /* end for each comment */ ?>

<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">نظر ها بسته شده اند</p>
<?php endif; ?>
<?php endif; ?>

<?php if ('open' == $post->comment_status) : ?>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p>
<?php else : ?>
<div class="clear"></div>

<div class="addcomments" id="sendcomment">
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post">
<div class="com-fild">
<div class="floatright">
<input type="text" name="author" id="author" placeholder="نام شما" tabindex="1" />
<div class="clear"></div>
<input type="text" name="email" id="email" placeholder="ایمیل شما" tabindex="2" />
<div class="clear"></div>
<input type="hidden" name="url" id="url" placeholder="وبسایت شما" tabindex="3" />
</div>
<div class="floatright">
<textarea name="comment" id="text" placeholder="متن نظر شما" tabindex="4" rows="4" cols="35"></textarea>
</div>
<div class="clear"></div>
<input id="submitr" class="aligncenter" name="submit" type="submit" tabindex="5" value="ارسال نظر" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</div>
</form>

</div>
<div class="clear"></div>


<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>

و کد صفحه سینگل هم که همینه :

<?php comments_template(); ?>

لینک به ارسال

کدهای استاندارد نیستند

بهتره از کدهای پوسته پیشفرض استفاده کنید

لینک به ارسال

اگر قبل از نظرات از کوئری استفاده میکنید (مثل مطالب مرتبط و یا ...) مطمئن باشید که کوئری در انتها ریست شده باشه.

لینک به ارسال

براتون یه پخ ارسال کردم اگه زحمتی نیست یه بررسی کنید

داخل پنل امکان ویرایش فایل هست

راستی الان فایل کامنت رو از تم 2013 گذاشتم ولی یه فایل -comments.php هم هست که کد ویرایش شده هست

لینک به ارسال
  • 4 هفته بعد...

سلام من هم همین مشکل رو دارم و برای کامنت از هسته وردپرس استفاده میکنم اینم فایل single


<?php get_header(); ?>
<?php get_sidebar();?>
<div class="holder-two">
<div id="slide">
<?php do_action('slideshow_deploy', '78'); ?>
</div>
<?php while(have_posts()) : the_post(); ?>
<div class="content-holder">
<article class="content">
<h2><a href="<?php the_permalink()?>">
<?php the_title();?>
</a></h2>
<div class="title-split"></div>
<div class="thumb-nail">
<?php the_post_thumbnail('thumbnail'); ?>
</div>
<div class="content-text">
<?php the_content(); ?>
</div>
<div class="detail">
<table dir="rtl">
<tr>
<td class="detail-author">نویسنده:<?php the_author() ?></td>
<td class="detail-date">تاریخ انتشار:<?php the_time('l j F Y'); ?></td>
<td class="detail-comment"><?php comments_popup_link(); ?></td>
<td class="more-link"><a href="<?php the_permalink()?>">ادامه مطلب</a></td>
</tr>
</table>
</div>
<div class="clear"></div>
</article>
</div>
<div class="post-tag">
<p><?php wp_tag_cloud('smallest=7&largest=7&number=50'); ?></p>
</div>
<div class="related-post">
<h3>مطالب مشابه</h3>
<div class="post-listing">
<?php
$orig_post = $post;
global $post;
$tags = wp_get_post_tags($post->ID);

if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=>6, // تعداد مطالب مرتبط.
'caller_get_posts'=>1
);

$my_query = new wp_query( $args );
while( $my_query->have_posts() ) {
$my_query->the_post();
?>
<div class="related-item">
<div class="post-thumbnail">
<a rel="external" href="<?php the_permalink()?>"><?php the_post_thumbnail ('related-thumb'); ?></a>
</div><!--post-thumbnail /-->
<h3><a href="<?php the_permalink()?>"><?php the_title() ?></a></h3>
</div>

<?php
}
echo '</ul>';
}else{
echo 'این پست فاقد مطالب مرتبط میباشد';
}
?>
<?
$post = $orig_post;
wp_reset_query();
?>
</div><!--relatedpost /-->
</div><!--related-post /-->
<?php comments_template(); ?>
<?php endwhile; ?>
</div><!--holder-two /-->
<?php get_sidebar('ads');?>
<?php get_footer();?>

لینک به ارسال

کد مشکلی نداره

چه مشکلی دارید؟

وقتی که یک کامنت اضافه میکردم توی همه ی صفحه ها همون کامنت رو نشون میداد

دستتون درد نکنه.

وردپرس رو ریست کردم درست شد.

ویرایش شده توسط hami73
لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...