I've been slamming my head against a wall trying to figure this out but can't seem to get a solution. I have offset defined as 0 but in my pagination links offset+1 for older posts just leads to an error page. Not really sure where I'm going wrong. Any help would be appreciated.
Here is all the code from my page.php file...
<?php
$offset = $_GET['offset'] ? $_GET['offset'] : 0;
$page_title = $wp_query->post->post_title;
$total_posts = wp_count_posts()->publish;
if ( $page_title == "Blog" ) {
?>
<div id="blog_content">
<?php
if($_GET['message']){
echo "<div style='background-color:#d9ffd1; padding:10px; margin-bottom:20px;'>".stripslashes($_GET["message"])."</div>";
}
?>
<?php
$post_count = 0;
$args = array( 'numberposts' => 10, 'post_status' => "publish", "offset"=>$offset*10);
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); $post_count++; ?>
And then my pagination links
<div style="font-size:12px;">
<div style="float:left; width:49%;">
<?php
the_post();
if ($offset > 0): ?>
<a href="<?php the_permalink()?>&offset=<?=$offset-1?>">← Newer Posts</a>
<?php endif; ?>
</div>
<div style="float:right; width:49%; text-align: right;">
<?php
$next_post = get_next_post();
if ($total_posts > $post_count + ($offset*10)): ?>
<a href="<?php the_permalink()?>&offset=<?=$offset+1?>">Older Posts →</a>
<?php endif; ?>
</div>
<div style="clear:both;"></div>
</div>
Thanks in advance for any help anyone can provide