Skip to content

Commit

Permalink
Add "after last page" option
Browse files Browse the repository at this point in the history
This option allowes to add a custom href/link on the last page. It's different to the $after, because it looks like the "next" button, so users can be led to a recommended follow-up page.
  • Loading branch information
aadlung committed Jul 30, 2015
1 parent c300d07 commit 8441b44
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion core.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ function wp_pagenavi( $args = array() ) {
'options' => array(),
'query' => $GLOBALS['wp_query'],
'type' => 'posts',
'echo' => true
'echo' => true,
'afterlastpage' => ''
) );

extract( $args, EXTR_SKIP );
Expand Down Expand Up @@ -179,6 +180,16 @@ function wp_pagenavi( $args = array() ) {
'class' => $class_names['last'],
), '%TOTAL_PAGES%' );
}

// Consumer binding with an option do add link "after last page"
if( ($paged == $total_pages) && ($instance->afterlastpage !== '') ) {
$out .= html('a', array(
'class' => 'nextpostslink',
'rel' => 'next',
'href' => $instance->afterlastpage
) );
}

break;

// Dropdown
Expand Down

2 comments on commit 8441b44

@lesterchan
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any use case for this though. I will leave it open to see if this is a popular request. So far you are the first

@aadlung
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes only sense in a multipart post, so you can create something like a set of small pages, and after them, link a user to a related/recommended post or gallery (increase page views).

Please sign in to comment.