tazeh 625 ارسال شده در مرداد 92 گزارش بازنشر ارسال شده در مرداد 92 (ویرایش شده) سلاماز کد زیر هم برای ایندکس یا صفحه اصلی استفاده می کنم. <?php include(TEMPLATEPATH . '/header.php'); ?><div class="warp"><div id="page"><!--Start Sidebar--><?php include(TEMPLATEPATH . '/sidebar-right.php'); ?><!--End Sidebar--><!--Start Center--><div id="center"><!--Start Slider--><?php include(TEMPLATEPATH . '/slideshow.php'); ?><!--End Slider--><!--Start News--><?php if (is_home()) {$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;query_posts("cat=1,2,3,40&showposts=20&paged=$paged");} ?><?php if(have_postS()) { while(have_posts()){ the_post(); ?><div class="news" onclick="parent.location='<?php the_permalink() ?>'"><a class="title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo mySubString(get_the_title(),60); ?></a><?php $type = get_field('type'); if(isset($type)) { echo type_post($type); }?><div class="thumb"><img class="thumb" src="<?php echo catch_that_image() ?>" alt="بدون عکس" /></div><p> <?php the_content_rss('...', TRUE, '', 50); ?></p><div class="linner"><span class="liker">لایک: <?php if(function_exists(getILikeThis)) getILikeThis('get'); ?></span> <span class="">بازدید:</span> <span></span></div></div><?php } ?><?php }else { ?><div class="news"><a href="">مطلب مورد نظر پیدا نشد!</a><div class="type video"></div><p> مطلب مورد نظر پیدا نشد!</p></div><?php } ?><!--Start News--></div><!--End Center--><!--Start Sidebar Left--><?php include(TEMPLATEPATH . '/sidebar-left.php'); ?><!--End Sidebar Left--><!--start Yaddasht--><div id="yaddasht"><h2>یادداشت</h2><div id="yaddasht-wrapper"><div class="yaddasht-slider"> <ul> <?php $recent = new WP_Query("category_name=note&showposts=15"); while($recent->have_posts()) : $recent->the_post();?> <li onclick="parent.location='<?php the_permalink() ?>'"> <div class="thumb"> <?php if(has_post_thumbnail()) {the_post_thumbnail('yadddasht');} else {echo '<img src="'.get_bloginfo("template_url").'/img/no-image.png" />';}?> </div> <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php echo mySubString(get_the_title(),25); ?></a> <span class="author"><?php the_field('author'); ?></span> </li> <?php endwhile; ?> </ul></div></div></div><!--start Yaddasht--><div id="multi-slide"><div id="gardeshgary"><h2>گردشگری</h2><div id="gardeshgary-slider"> <ul> <?php $recent = new WP_Query("category_name=گردشگری&showposts=10"); while($recent->have_posts()) : $recent->the_post();?> <li onclick="parent.location='<?php the_permalink() ?>'"> <div class="thumb"> <?php if(has_post_thumbnail()) {the_post_thumbnail('yadddasht');} else {echo '<img src="'.get_bloginfo("template_url").'/img/no-image.png" />';}?> </div> <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php echo mySubString(get_the_title(),25); ?></a> <span class="author"><?php the_field('author'); ?></span> </li> <?php endwhile; ?> </ul></div></div><div id="line-slide"></div><div id="eghtesad"><h2>اقتصاد</h2><div id="eghtesad-slider"> <ul> <?php $recent = new WP_Query("category_name=economy-down&showposts=10"); while($recent->have_posts()) : $recent->the_post();?> <li onclick="parent.location='<?php the_permalink() ?>'"> <div class="thumb"> <?php if(has_post_thumbnail()) {the_post_thumbnail('yadddasht');} else {echo '<img src="'.get_bloginfo("template_url").'/img/no-image.png" />';}?> </div> <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php echo mySubString(get_the_title(),25); ?></a> <span class="author"><?php the_field('author'); ?></span> </li> <?php endwhile; ?> </ul></div></div></div></div></div><?php include(TEMPLATEPATH . '/footer.php'); ?> واز کد زیر برای نمایش آخرین مطالب دسته در سایدبار استفاده می کنم.//// اما وقتی این کدو رو میزارم توی ایندکس هم همین مطالب رو نشون می ده در صورتی که cat هاشون شبیه هم نیست. یا عباری سایدبار روی ایندکس تاثیر میزاره و مطالب ساید بار رو نشون می ده.iv id="sidebar-right"><div class="widget"><h2 class="widget_title"><span>اس ام اس ها</span></h2><ul><?php query_posts("showposts=25&cat=1"); ?><?php while (have_posts()) : the_post(); ?><li><a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php the_title(); ?></a></li><?php endwhile; ?></ul></div> ویرایش شده مرداد 92 توسط Morteza نقل قول لینک به ارسال
Bright Moon 653 ارسال شده در مرداد 92 گزارش بازنشر ارسال شده در مرداد 92 جناب قبلش یه دونه<?php wp_reset_query(); ?>بزار ببین درست میشه؟قبلاً دیده شده این خط کد معجزه میکنه 2 نقل قول لینک به ارسال
tazeh 625 ارسال شده در مرداد 92 مالک گزارش بازنشر ارسال شده در مرداد 92 درست نشد نقل قول لینک به ارسال
Morteza 34190 ارسال شده در مرداد 92 گزارش بازنشر ارسال شده در مرداد 92 بعد از کوئری ها باید ریست کنیدهرجایی که کوئری دارید ریست کنید 1 نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .