رفتن به مطلب

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


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

با سلام

این کد واسه مطالب اتفاقیه از پستها فقط یکی رو به تعدادی که مشخص میکنیم تکرار میکنه کسی میدونه مشکل چیه؟


<p align="right"> <?php
$args = array( 'numberposts' => 5, 'orderby' => 'rand' );
$rand_posts = get_posts( $args );
foreach( $rand_posts as $post ) : ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br/>
<?php endforeach; ?> </P>

لینک به ارسال

من خودم فهمیدم کد صحیح این است


<p align="right"> <?php
query_posts(array('orderby' => 'rand', 'showposts' => 5));
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?></a><br/>
<?php endwhile;
endif; wp_reset_query(); ?></p>

لینک به ارسال
مهمان
این موضوع برای عدم ارسال قفل گردیده است.
×
×
  • اضافه کردن...