Wp_link_pages last page goes to Next Post

Posted in: Newspaper
Post count: 23

Hello,

I am trying to code in an if statement that basically says if last page of paginated post then go to next article. While still using the same navigation buttons.

I have this in the td_module_single_base:
function get_post_pagination() {
if (!$this->is_single) {
return '';
}
return wp_link_pages(array(
'before' => '<div class="td-stupid-list-pagination"><div class="td-stupid-list-button td-stupid-back">',
'after' => '</div>',
'link_before' => '<div>',
'link_after' => '</div>',
'echo' => false,
'separator' => '</div> <div class="td-stupid-list-button td-stupid-next">',
'next_or_number' => 'next',
'nextpagelink' => '<div class="stupid-next">NEXT</div></div>',
'previouspagelink' => '<div class="stupid-prev">PREVIOUS</div>',
));
}

I essentially need some sort of statement i think that just checks if it is the last page of the post and then if so have the next button click to the next article. ( or a static page )

I think I need to add a statement like this: but I think I am missing some pieces.

if($page === $numpages)
{
next_post('%','Next','');
}

Thanks!

Post count: 22421
Post count: 23

function get_post_pagination() {
global $multipage, $numpages, $page;

if (!$this->is_single) {
return '';
}

if($multipage && $page == $numpages) {
$link_address = 'http://your-domain.com/continue-reading';

echo "<div class='td-stupid-list-nextpost-button td-stupid-nextpost'><div class='stupid-nextpost'>NEXT</div></div>";

}

return wp_link_pages(array(
'before' => '<div class="td-stupid-list-pagination"><div class="td-stupid-list-button td-stupid-back">',
'after' => '</div>',
'link_before' => '<div>',
'link_after' => '</div>',
'echo' => false,
'separator' => '</div> <div class="td-stupid-list-button td-stupid-next">',
'next_or_number' => 'next',
'nextpagelink' => '<div class="stupid-next" style = "float:right;">NEXT</div></div>',
'previouspagelink' => '<div class="stupid-prev" style = "float:left;">PREVIOUS</div>',
));

}

In case anyone else wants a custom end page on all paginated posts that was the code I had to use.

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.