Having issues getting this working
[[LINK href="http://depositcasino.info/newestslots/"]][[/LINK]]
Basically I want only to paginate the bottom 3. I'm basic learner so I need a solution that will work for me. Using plugin page numbers.
This is a subpage template with posts inside it.
<div class="review-left-brand"></div>
</div>
<?php
query_posts('category_name=newgames'. '&tag=slots-detail+uk' .'&posts_per_page=1');
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
<div class="review-left-featured">
<div class="review-left-rating">
<div align="center">
<?php wp_gdsr_render_article(10, false);?>
</div>
</div>
<div align="center"> <a href="<?php echo get('affid');?>" class="playnow-review"></a>
<div class="review-left-screenarea"><?php echo get_image('screenbig');?></div>
<div class="review-left-screenshadow"><img src="<?php bloginfo('stylesheet_directory');?>/images/shadow.jpg" width="244" height="69" /></div>
</div>
</div>
<!--/reviewleftfeatured-->
<div class="review-left-r-featured">
<div class="review-left-r-bonus"> <span class="big"> <?php echo get('bonus');?></span><br />
<?php echo get('bonuspercent');?> Match bonus<br />
<?php echo get('ndbonus');?> ND Bonus <br />
</div>
<div class="review-left-r-toc"><strong><?php echo get('casinoname');?> Bonus</strong>
<ul>
<li><a href="<?php echo get('affid');?>">Signup using our Links</a></li>
<li>Bonus Code:<?php echo get('code');?></li>
<li><?php echo get('redemption');?></li>
<li><?php echo get('usadropdown');?></li>
<li>International accepted.</li>
</ul>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<!--/revierightfeatured-->
<div class="title">
<h2>
<?php wp_title();?>
</h2>
<ul style="height:10px;">
</ul>
</div>
<!--/title-->
<div class="pan_game_show">
<div class="pan_game_upper">
<?php
query_posts('category_name=newgames'.'&paged=' . get_query_var('paged') . '&tag=slots-detail+uk' .'&posts_per_page=3' .'&offset=1');
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
<div class="pan_game_upper_container01">
<div class="pan_game_container01_title"><?php echo get('name');?></div>
<div class="pan_game_container_image"><a href="<?php echo get('affid');?>"><?php echo get_image('screenbig');?></a></div>
<div class="pan_game_container_desc"> <?php echo content(20);?>.
<div align="center"><a href="<?php echo get('affid');?>">
<div style="background:#f5f5f5;height:60px;" class="corner"><img src="<?php echo get('logo');?>" alt="<?php the_title();?>" width="auto" height="auto" style="float:left;padding:5px;"/><span href="<?php echo get('affid');?>" style="font-size:24px;padding:0 10px 0 0;line-height:60px;"><?php echo get('bonus');?></span></div>
</a></div>
</div>
<div style="clear:both"></div>
</div>
<?php endwhile; ?>
<?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>
<?php endif; ?>
<div style="clear:both"></div>
</div>
</div>
<!--/top 3-->
Kailey Lampert answers:
To start, you may want to add <?php wp_reset_query(); ?>
between your loops - probably right before your second query_posts()
function.
If that doesn't work some magic, could you provide a few more details? If possible, a link to where we can see this live.
---
Update: I couldn't sleep, so here's what I've come up with, it's more in depth than my above suggestion:
* uses WP_Query() for the first post - this way the first post will always be the most recent post
* saves the ID of that post so it can be excluded from the second loop
* uses the traditional query_posts() for the bottom 3
<?php
/*
Template Name: Index
*/
?>
<?php get_header(); ?>
<div class="review-left-brand"></div>
</div>
<?php
$first_query = new WP_Query('category_name=newgames'. '&tag=slots-detail+uk' .'&posts_per_page=1');
if ( $first_query->have_posts() ) : while ( $first_query->have_posts() ) : $first_query->the_post();
?>
<div class="review-left-featured">
<div class="review-left-rating">
<div align="center">
<?php wp_gdsr_render_article(10, false);?>
</div>
</div>
<div align="center"> <a href="<?php echo get('affid');?>" class="playnow-review"></a>
<div class="review-left-screenarea"><?php echo get_image('screenbig');?></div>
<div class="review-left-screenshadow"><img src="<?php bloginfo('stylesheet_directory');?>/images/shadow.jpg" width="244" height="69" /></div>
</div>
</div>
<!--/reviewleftfeatured-->
<div class="review-left-r-featured">
<div class="review-left-r-bonus"> <span class="big"> <?php echo get('bonus');?></span><br />
<?php echo get('bonuspercent');?> Match bonus<br />
<?php echo get('ndbonus');?> ND Bonus <br />
</div>
<div class="review-left-r-toc"><?php echo get('casinoname');?> Bonus
<ul>
<li><a href="<?php echo get('affid');?>">Signup using our Links</a></li>
<li>Bonus Code:<?php echo get('code');?></li>
<li><?php echo get('redemption');?></li>
<li><?php echo get('usadropdown');?></li>
<li>International accepted.</li>
</ul>
</div>
</div>
<?php endwhile; ?>
<?php $first_post = $post->ID; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
<!--/revierightfeatured-->
<div class="title">
<h2>
<?php wp_title();?>
</h2>
<ul style="height:10px;">
</ul>
</div>
<!--/title-->
<div class="pan_game_show">
<div class="pan_game_upper">
<?php
$args = array( 'category_name' => 'newgames',
'paged' => get_query_var('paged'),
'tag' => 'slots-detail+uk',
'posts_per_page' => 3,
'post__not_in' => array($first_post)
);
query_posts($args);
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
<div class="pan_game_upper_container01">
<div class="pan_game_container01_title"><?php echo get('name');?></div>
<div class="pan_game_container_image"><a href="<?php echo get('affid');?>"><?php echo get_image('screenbig');?></a></div>
<div class="pan_game_container_desc"> <?php echo content(20);?>.
<div align="center"><a href="<?php echo get('affid');?>">
<div style="background:#f5f5f5;height:60px;" class="corner"><img src="<?php echo get('logo');?>" alt="<?php the_title();?>" width="auto" height="auto" style="float:left;padding:5px;"/><span href="<?php echo get('affid');?>" style="font-size:24px;padding:0 10px 0 0;line-height:60px;"><?php echo get('bonus');?></span></div>
</a></div>
</div>
<div style="clear:both"></div>
</div>
<?php endwhile; ?>
<?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>
<?php endif; ?>
<div style="clear:both"></div>
</div>
</div>
<!--/top 3-->
<?php get_footer(); ?>
Denzel Chia answers:
Hi,
Try putting the wp page numbers function above the end while
Because end while is the ending of WordPress loop.
Perhaps the wp page numbers function needs to be within the loop.
Thanks.
Nilesh shiragave answers:
Hi
just change your second loop query_posts() line which is now
<?php
query_posts('category_name=newgames'.'&paged=' . get_query_var('paged') . '&tag=slots-detail+uk' .'&posts_per_page=3' .'&offset=1');
?>
with this one
<?php
wp_reset_query();
query_posts('category_name=newgames'.'&tag=slots-detail+uk' .'&posts_per_page=3'.'&offset=1'.'&paged='. curPageURL());
?>
and add this function in your themes function.php add it just before last closing ?> php tag
if(!function_exists('curPageURL'))
function curPageURL() {
$pageURL = 'http';
//check what if its secure or not
if ($_SERVER["HTTPS"] == "on") {
$pageURL .= "s";
}
//add the protocol
$pageURL .= "://";
//check what port we are on
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
//cut off everything on the URL except the last 3 characters
$urlEnd = substr($pageURL, -3);
//strip off the two forward shashes
$page = str_replace("/", "", $urlEnd);
//return just the number
return $page;
}
}