saeed.spore
November 8th, 2014, 02:10
سلام چطور میتون آخرین مطالب سایت
با حلقه ای بسازم یکی نه یک یا به صورت زوج به li ها لیستم استایل بده
مثلا
<li>خبر جدید ما</li>
<li style="background-color: rgb(17, 17, 17);">خبر جدید ما</li>
<li>خبر جدید ما</li>
<li style="background-color: rgb(17, 17, 17);">خبر جدید ما</li>
<li>خبر جدید ما</li>
<li style="background-color: rgb(17, 17, 17);">خبر جدید ما</li>
- - - Updated - - -
شرمنده جستجو خوبی انجام ندادم
ولی این کد همونه که من نیاز داشتم میگذارم شاید بعدا کسی اگه تاپیک خواند به سردرگمی دچار نشده
<?php
$x = 'odd';
$custom_query = new WP_Query(array(
'post_status' =>'publish',
'post_type' =>'post',
'order' =>'DESC',
'orderby' =>'ID',
'posts_per_page' =>'5',
'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1
));
if($custom_query->have_posts()) :
echo '<ul class="queryposts list-group">';
while($custom_query->have_posts()) : $custom_query->the_post();
?>
<li class="list-group-item <?php echo $x;?>">
<h5 class="querypost-title list-group-item-heading" id="title-<?php the_ID();?>"><a href="javascript:void(0)"><?php the_title(); ?></a></h5>
<div class="querypost-excerpt list-group-item-text" id="excerpt-<?php the_ID();?>"><?php the_excerpt();?>
<div class="more text-left">
<a class="btn btn-info" href="<?php the_permalink(); ?>">ادامه مطلب</a>
</div>
</div>
</li>
<?php
if($x=='odd') {
$x = 'even';
}
else {
$x = 'odd';
}
endwhile;
echo '</ul>';
endif;
wp_reset_query();
?>
با حلقه ای بسازم یکی نه یک یا به صورت زوج به li ها لیستم استایل بده
مثلا
<li>خبر جدید ما</li>
<li style="background-color: rgb(17, 17, 17);">خبر جدید ما</li>
<li>خبر جدید ما</li>
<li style="background-color: rgb(17, 17, 17);">خبر جدید ما</li>
<li>خبر جدید ما</li>
<li style="background-color: rgb(17, 17, 17);">خبر جدید ما</li>
- - - Updated - - -
شرمنده جستجو خوبی انجام ندادم
ولی این کد همونه که من نیاز داشتم میگذارم شاید بعدا کسی اگه تاپیک خواند به سردرگمی دچار نشده
<?php
$x = 'odd';
$custom_query = new WP_Query(array(
'post_status' =>'publish',
'post_type' =>'post',
'order' =>'DESC',
'orderby' =>'ID',
'posts_per_page' =>'5',
'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1
));
if($custom_query->have_posts()) :
echo '<ul class="queryposts list-group">';
while($custom_query->have_posts()) : $custom_query->the_post();
?>
<li class="list-group-item <?php echo $x;?>">
<h5 class="querypost-title list-group-item-heading" id="title-<?php the_ID();?>"><a href="javascript:void(0)"><?php the_title(); ?></a></h5>
<div class="querypost-excerpt list-group-item-text" id="excerpt-<?php the_ID();?>"><?php the_excerpt();?>
<div class="more text-left">
<a class="btn btn-info" href="<?php the_permalink(); ?>">ادامه مطلب</a>
</div>
</div>
</li>
<?php
if($x=='odd') {
$x = 'even';
}
else {
$x = 'odd';
}
endwhile;
echo '</ul>';
endif;
wp_reset_query();
?>