نگار صادقی 1025 ارسال شده در تیر 92 گزارش بازنشر ارسال شده در تیر 92 سلام. ایجا کلیک کنید. من میخوام پست هایی هر دسته رو نمایش بدم ولی هرچی آیدی دسته رو توی کوئری های مورد نظر میزارم پست ها رو نمایش نمیده!!!! باید چجوری آیدی هر دسته رو کجا قرار بدم که پست هاشو توی کادر مربوط به خودش نشون بده؟برای هر کدوم از اون کادر ها که توی صفحه اوله یه فایل درست کردن و کدهای زیر رو توش قرار دادن. <?php include(TEMPLATEPATH . '/header.php'); ?><?php global $date; $date=date('m/j'); ?><div id="col3" class="cls"><div class="right"><div class="box3 rad8"><div class="title"><span class="tc">» </span><a href="<?php bloginfo('url'); ?>/category/News">مجله خبری</a></div><?php if (have_posts()) : while (have_posts()) : the_post(); ?><div class="page-content"><a href="<?php the_permalink(); ?>"><?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo '<img src="'.get_bloginfo("template_url").'/images/no-image.gif" />';}?></a><a class="lt1" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br><?php the_content_rss('', TRUE, '', 40); ?></div><?php endwhile; else: ?><h2 class="center"><?php _e('یافت نشد !'); ?></h2><p class="center"><?php _e('متأسفانه جستجوی شما نتیجه ای در بر نداشت.'); ?></p><?php endif; ?><div class="pages"><?php if(wp_pagenavi()) {wp_pagenavi();} ?></div></div></div><div class="left"><?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?> <?php endif; ?><div class="box2 cls"><div id="imags" class="cls"><?php $recent = new WP_Query("cat=2&showposts=16"); while($recent->have_posts()) : $recent->the_post();?><a target="_top" href="<?php the_permalink() ?>" class="tt" title="<?php the_title(); ?>"><div class="im"><?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo '<img src="'.get_bloginfo("template_url").'/images/no-image.gif" />';}?></div></a><?php endwhile; ?></div></div><div class="box2 cls"><div class="title">جدیدترین مطالب سایت</div><ul class="cls"><?php $recent = new WP_Query("cat=-19&showposts=15&cat=-19"); while($recent->have_posts()) : $recent->the_post();?><?php $date_post=get_the_time('m/j'); ?><li><span class="tc2">»</span> <a class="tt" title="<?php the_content_rss('', TRUE, '', 60); ?>" href="<?php the_permalink() ?>" class="lt1 "><?php the_title(); ?><?php if($date_post==$date){echo '<font color="red"> جديد</font>';} ?></a></li><?php endwhile; ?></ul></div><div class="box2 cls"><div class="title">لینک دوستان</div><ul class="cls"><?php$bm = get_bookmarks( array('orderby' => 'rand','order' => 'ASC','limit' => 15,'category' => null,'hide_invisible' => 1,'show_updated' => 0,'include' => null,'exclude' => null,'search' => '.'));foreach ($bm as $bookmark){ echo "<li class=dot><a rel='nofollow' href='{$bookmark->link_url}' target=_blank> {$bookmark->link_name} </a></li>"; }?><center><li style="border:1px dashed #333333;margin-top:10px;padding-bottom:6px;padding-top:5px;"><a href="<?php bloginfo('url'); ?>/link/"><b><font color="red">تبادل لیتک</font></b></a></li></center></ul></div><?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?> <?php endif; ?></div></div></div><?php include(TEMPLATEPATH . '/footer.php'); ?></div></div></body></html>من آیدی هر دسته رو توی اینجای کد قرار میدم (2 آیدی دستمه) ولی پست های دسته رو نمایش نمیده<?php $recent = new WP_Query("cat=2&showposts=16"); while($recent->have_posts()) : $recent->the_post();?> نقل قول لینک به ارسال
Morteza 34190 ارسال شده در تیر 92 گزارش بازنشر ارسال شده در تیر 92 کوئری رو باید در آخر هر حلقه ریست کنید: <?php include(TEMPLATEPATH . '/header.php'); ?><?php global $date; $date=date('m/j'); ?><div id="col3" class="cls"><div class="right"><div class="box3 rad8"><div class="title"><span class="tc">» </span><a href="<?php bloginfo('url'); ?>/category/News">مجله خبری</a></div><?php if (have_posts()) : while (have_posts()) : the_post(); ?><div class="page-content"><a href="<?php the_permalink(); ?>"><?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo '<img src="'.get_bloginfo("template_url").'/images/no-image.gif" />';}?></a><a class="lt1" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br><?php the_content_rss('', TRUE, '', 40); ?></div><?php endwhile; else: ?><h2 class="center"><?php _e('یافت نشد !'); ?></h2><p class="center"><?php _e('متأسفانه جستجوی شما نتیجه ای در بر نداشت.'); ?></p><?php endif; ?><div class="pages"><?php if(wp_pagenavi()) {wp_pagenavi();} ?></div></div></div><div class="left"><?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?> <?php endif; ?><div class="box2 cls"><div id="imags" class="cls"><?php query_posts("cat=2&showposts=16"); while(have_posts()) : the_post();?><a target="_top" href="<?php the_permalink() ?>" class="tt" title="<?php the_title(); ?>"><div class="im"><?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo '<img src="'.get_bloginfo("template_url").'/images/no-image.gif" />';}?></div></a><?php endwhile; wp_reset_query(); ?></div></div><div class="box2 cls"><div class="title">جدیدترین مطالب سایت</div><ul class="cls"><?php query_posts("cat=-19&showposts=15"); while(have_posts()) : the_post();?><?php $date_post=get_the_time('m/j'); ?><li><span class="tc2">»</span> <a class="tt" title="<?php the_content_rss('', TRUE, '', 60); ?>" href="<?php the_permalink() ?>" class="lt1 "><?php the_title(); ?><?php if($date_post==$date){echo '<font color="red"> جديد</font>';} ?></a></li><?php endwhile; wp_reset_query(); ?></ul></div><div class="box2 cls"><div class="title">لینک دوستان</div><ul class="cls"><?php$bm = get_bookmarks( array('orderby' => 'rand','order' => 'ASC','limit' => 15,'category' => null,'hide_invisible' => 1,'show_updated' => 0,'include' => null,'exclude' => null,'search' => '.'));foreach ($bm as $bookmark){ echo "<li class=dot><a rel='nofollow' href='{$bookmark->link_url}' target=_blank> {$bookmark->link_name} </a></li>"; }?><center><li style="border:1px dashed #333333;margin-top:10px;padding-bottom:6px;padding-top:5px;"><a href="<?php bloginfo('url'); ?>/link/"><b><font color="red">تبادل لیتک</font></b></a></li></center></ul></div><?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?> <?php endif; ?></div></div></div><?php include(TEMPLATEPATH . '/footer.php'); ?></div></div></body></html> 3 نقل قول لینک به ارسال
نگار صادقی 1025 ارسال شده در تیر 92 مالک گزارش بازنشر ارسال شده در تیر 92 (ویرایش شده) آقا مرتضی ممنون. ریست کردن کوئری چه کاری رو انجام میده؟الان این کارو کردم ولی فرقی نکرد!!! باز پست های دسته ای که آیدیش رو وارد کردم رو نمایش نمیده!!!! ویرایش شده تیر 92 توسط نگار صادقی نقل قول لینک به ارسال
Parsa 23463 ارسال شده در تیر 92 گزارش بازنشر ارسال شده در تیر 92 ریست کردن باعث میشه آرایه هایی که ست شدند از 0 شروع شوند<?php include(TEMPLATEPATH . '/header.php'); ?><?php global $date; $date=date('m/j'); ?><div id="col3" class="cls"><div class="right"><div class="box3 rad8"><div class="title"><span class="tc">» </span><a href="<?php bloginfo('url'); ?>/category/News">مجله خبری</a></div><?php if (have_posts()) : while (have_posts()) : the_post(); ?><div class="page-content"><a href="<?php the_permalink(); ?>"><?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo '<img src="'.get_bloginfo("template_url").'/images/no-image.gif" />';}?></a><a class="lt1" href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br><?php the_content_rss('', TRUE, '', 40); ?></div><?php endwhile; else: ?><h2 class="center"><?php _e('یافت نشد !'); ?></h2><p class="center"><?php _e('متأسفانه جستجوی شما نتیجه ای در بر نداشت.'); ?></p><?php endif; ?><div class="pages"><?php if(wp_pagenavi()) {wp_pagenavi();} ?></div></div></div><div class="left"><?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?> <?php endif; ?><div class="box2 cls"><div id="imags" class="cls"><?phpwp_reset_postdata();wp_reset_query();query_posts("cat=2&showposts=16"); while(have_posts()) : the_post();?><a target="_top" href="<?php the_permalink() ?>" class="tt" title="<?php the_title(); ?>"><div class="im"><?php if(has_post_thumbnail()) {the_post_thumbnail();} else {echo '<img src="'.get_bloginfo("template_url").'/images/no-image.gif" />';}?></div></a><?php endwhile; wp_reset_query(); wp_reset_postdata(); ?></div></div><div class="box2 cls"><div class="title">جدیدترین مطالب سایت</div><ul class="cls"><?php query_posts("cat=-19&showposts=15"); while(have_posts()) : the_post();?><?php $date_post=get_the_time('m/j'); ?><li><span class="tc2">»</span> <a class="tt" title="<?php the_content_rss('', TRUE, '', 60); ?>" href="<?php the_permalink() ?>" class="lt1 "><?php the_title(); ?><?php if($date_post==$date){echo '<font color="red"> جديد</font>';} ?></a></li><?php endwhile; wp_reset_query(); ?></ul></div><div class="box2 cls"><div class="title">لینک دوستان</div><ul class="cls"><?php$bm = get_bookmarks( array('orderby' => 'rand','order' => 'ASC','limit' => 15,'category' => null,'hide_invisible' => 1,'show_updated' => 0,'include' => null,'exclude' => null,'search' => '.'));foreach ($bm as $bookmark){ echo "<li class=dot><a rel='nofollow' href='{$bookmark->link_url}' target=_blank> {$bookmark->link_name} </a></li>"; }?><center><li style="border:1px dashed #333333;margin-top:10px;padding-bottom:6px;padding-top:5px;"><a href="<?php bloginfo('url'); ?>/link/"><b><font color="red">تبادل لیتک</font></b></a></li></center></ul></div><?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?> <?php endif; ?></div></div></div><?php include(TEMPLATEPATH . '/footer.php'); ?></div></div></body></html>در کد اولتون هم میتوانید از wp_reset_query استفاده کنید 1 نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .