Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parametrise bookmarks in pagination links #318

Merged
merged 1 commit into from
Jul 18, 2018

Conversation

klemens-st
Copy link
Collaborator

Pagination links are automatically appended with bookmarks to the list they are part of, i.e. lcp_instance. While this is desirable by many users, it can cause a real mess in many (badly written 😉 ) themes and plugins. So I'm proposing to introduce pagination_bookmarks shortcode parameter. If present and set to no the plugin won't append bookmarks to pagination URLs.

Default (current) example link
http://example.org?lcp_page0=2#lcp_instance_0

With pagination_bookmarks=no
http://example.org?lcp_page0=2

Fixes #225, fixes #291

There were also many support questions on WP Forum, like this one or one from today

@@ -37,23 +37,26 @@ public function get_pagination($params){
$this->next_page_num = null;
if ($pages_count > 1){
for($i = 1; $i <= $pages_count; $i++){
$lcp_paginator .= $this->lcp_page_link($i, $params['page'], $params['instance']);
$lcp_paginator .= $this->lcp_page_link($i, $params['page'], $params['instance'],
null, $params['bookmarks']);
Copy link
Owner

Choose a reason for hiding this comment

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

Thanks @zymeth25! This is great as usual 👏
I was wondering if it would be ok to put char (or previous/next) as the last parameter of the lcp_page_link function to avoid passing in null. It looks like it would be fine, I tried it locally and it seems to be fine, tests pass and this file seems to be the only one using this function. What do you think? Do you mind if I add that change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, absolutely, that null doesn't look good in there. Just drop a short note in the changelog that this method has been refactored in case some users customized stuff in this file.

@picandocodigo picandocodigo merged commit 229d971 into picandocodigo:master Jul 18, 2018
@klemens-st klemens-st deleted the pagination-links branch July 19, 2018 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pagination not updating content Help! Pagination auto-scrolls page to bottom
2 participants