Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 96054

engineer93 on "Pagination Problem."

$
0
0

Hi support,
i try to write a code for pagination and i writeen this

<div class="otherarticles">

<?php if ( $cat==3)  {
 ?>
			    <p class="title" style="color: #269aee; !important;">altre news</p>
 <?php } else if ( $cat==65 ) {
 ?>
<p class="title" style="color: #fd6320; !important;">altre recensioni</p>
 <?php } else if ( $cat==1291 ) {
?>
<p class="title" style="color: #114981; !important;">altri Media</p>
<?php }  else if ( $cat==13)  {
?>
<p class="title" style="color: #6d59aa; !important;">altri articoli</p>
<?php }else{ ?>
<p class="title" style="color: #e5b84f; !important;">altre notizie (<?php echo get_cat_name( $cat ); ?>)</p>
<?php
}?>
					<div class="list">
					<ul>
<?php
// The Query
$category = get_category( get_query_var( 'cat' ) );
    $cat_id = $category->cat_ID;
 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$additional_loop = new WP_Query("cat=$cat_id&paged=$paged&posts_per_page=13&offset=1");
while ($additional_loop->have_posts()) : $additional_loop->the_post();
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'minihome' );
 $url = $thumb['0'];
?>

							<li>
								<div class="image" style="background-image: url('<?php echo $url ?>');">
<p class="categoryline">

 <?php if ( in_category('3') ) { ?>
 <span class="newstype">News</span>
 <?php }
else if ( in_category('65') ) { ?>
 <span class="recensionetype">Recensione</span>
 <?php }
 else if ( in_category('1291') ) { ?>
 <span class="newstype">Multimedia</span>
<?php
}else if ( in_category('13') )
 {
?>
 <span class="newstype">Articolo</span>
<?php
}
?>

									    <span>
<?php
$categories = get_the_category();
if($categories){
	foreach($categories as $category) {
if($category->cat_name=='News' || $category->cat_name=='Recensioni' || $category->cat_name=='In Evidenza' || $category->cat_name=='Multimedia'  || $category->cat_name=='Articoli')
{

}else
{
echo "/ ";
echo $category->cat_name;
echo " ";

}
	}
}
?>
</span></p>
									    <a href="<?php the_permalink() ?>">
										<p class="titleline"><?php the_title();?></p>
									    </a>
								</div>
							</li>
<?php
endwhile;
endif;
?>

						</ul>

				    <div class="bottombar">	<center>						<?php if (function_exists("pagination")) {
    pagination($additional_loop->max_num_pages);
} ?></center></span>
					</div>

The script works only for a little time, after each page shows the same posts.


Viewing all articles
Browse latest Browse all 96054

Trending Articles