PDA

View Full Version : وردپرس



دانیال دزفولی
شنبه 11 مرداد 1393, 21:31 عصر
سلام
با کد های زیر چطور میشه نوشت که اگه شرط if برقرار نبود تو .content یه چیزی بنویسه


<?php if(have_posts()):?>
<section class="the_posts">
<?php while(have_posts() ): ?>
<?php the_post(); ?>
<article class="the_post">
<div class="content">
<?php the_content(); ?>
</div>
</article>
<?php endwhile; ?>
</section>
<?php endif ?>

under22
شنبه 11 مرداد 1393, 21:38 عصر
الآن اگه شرط برقرار باشه یه چیزی مینوسه اگه میخای اگه برقرار نبود بنویسه یه ! بزار پشت شرط

دانیال دزفولی
شنبه 11 مرداد 1393, 21:50 عصر
کد هارو اینطوری تغییر دادم ولی حلقه ی وایل دچار مشکل شد

<?php if(have_posts()):?>
<section class="the_posts">
<?php while(have_posts() ): ?>
<?php the_post(); ?>
<article class="the_post <?php the_ID()?>">
<div class="content">
<?php the_content(); ?>
<?php if(!have_posts()){
echo'مطلبی یافت نشد';
}?>

</div>
</article>
<?php endwhile; ?>
</section>
<?php endif ?>

under22
شنبه 11 مرداد 1393, 22:06 عصر
فکر کنم منظورتو اشتباه فهمیدم یعنی یه جوری گفتی بد متوجه شدم .
دستوراتت به این شکل میشه


<?php
if(have_posts()){?>
<section class="the_posts">
<?php while(have_posts() ): ?>
<?php the_post(); ?>
<article class="the_post">
<div class="content">
<?php the_content(); ?>
</div>
</article>
<?php endwhile; ?>
</section>
<?php } else {echo 'مطلبی یافت نشد '; }?>