How to get that in php? I lost 2 days trying to solve this. plese help Description image is here...
Here is my code. I realy dont know how to solve this.
<?php /*----------------------- predelava --------------------------*/ ?>
<?php $temp_query = $wp_query; ?>
<?php query_posts('cat=7&showposts=5'); //'cat=1 <-- Tukaj vpiši id tvoje kategorije ?>
<?php $numposts = $wp_query->post_count; ?>
<?php while (have_posts()) : the_post(); ?>
<div class='<?php echo (++$j % 2 == 0) ? 'evenpost' : 'oddpost'; ?>'>
<?php if ($j != $numposts){
the_content();
}
?>
</div>
<?php if($numposts %2 == 0 && $j == $numposts)
{
?>
<div class="center">
<?php the_content(); ?>
</div>
<?php // class "center" definiraj v css fajlu tako da bo pozicioniran kot želiš ;)
}
?>
<?php endwhile;?>
<?php $wp_query = $temp_query; ?>
I tried also this way:
<?php
/*----------------------- predelava --------------------------*/
$temp_query = $wp_query; ?>
<?php query_posts('cat=7&showposts=5'); //'cat=1 <-- Tukaj vpiši id tvoje kategorije ?>
<?php $numposts = $wp_query->post_count; ?>
<?php while (have_posts()) : the_post(); ?>
<div class='<?php echo (++$j % 2 == 0) ? 'evenpost' : 'oddpost'; ?>'>
<?php if ($j != $numposts){
the_content();
} ?></div>
<?php if($numposts %2 != 0 && $j == $numposts)
{
?><div class="center"><?php the_content(); ?></div> <?php // class "center" definiraj v css fajlu tako da bo pozicioniran kot želiš ;)
}
?>
<?php endwhile; ?>
<?php $wp_query = $temp_query; ?>
</div>
Best regards from Slovenia