Pagination pages all galleries displayed on page
-
Again a question on pagination……
Whenever I have more than one gallery on my web page (either more than one in a post or more posts with a gallery) and they all have pagination, as soon as I page one all galleries page!
Is this intentional? If so, how can I block that?
-
Thanks for posting this question, which came up back in a support topic from October 2013:
The third post in that topic begins with:
My investigation and testing led me to the conclusion that the best way to satisfy the “multiple paginated galleries” requirement is to add a new parameter to the
[mla_gallery]
shortcode. The next MLA version will introducemla_page_parameter
, which changes the parameter used to track gallery page numbers frommla_paginate_current
to another name for any single gallery.The
mla_page_parameter
is the answer to your requirements. Here is an example of two paginated galleries on one page:[mla_gallery attachment_category=admin posts_per_page=2] Go to page: [mla_gallery attachment_category=admin posts_per_page=2 mla_output="paginate_links,show_all"] ---------- [mla_gallery attachment_category=teachers posts_per_page=1 mla_page_parameter="mla_paginate_current_2"] Go to page: [mla_gallery attachment_category=teachers posts_per_page=1 mla_output="paginate_links,show_all" mla_page_parameter="mla_paginate_current_2"]
As you can see, the first gallery and pagination controls use the default value for
mla_page_parameter
. The second pair of shortcodes specify a different, unique valuemla_page_parameter="mla_paginate_current_2"
in both of the shortcodes.You should be able to adapt the example to your application. I am marking this topic resolved, but please update it if you have any problems or further questions regarding separate pagination of multiple galleries on the same post/page.
First of all I read the documentation on this parameter and did not conclude that this would the parameter to use for me in this case.
So maybe it needs some clarification?But although the gallery itself pages nicely if I click on its pager and the other one remains untouched the pager display itself isn’t.
I currently have this code:
<code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2012))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" ] </code> <code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2012))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" mla_output="paginate_links,prev_next" mla_page_parameter="mla_paginate_current_2"] </code> <hr/> <code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2011))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" ] </code> <code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2011))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" mla_output="paginate_links,prev_next" mla_page_parameter="mla_paginate_current_2"] </code> <hr/>
If I page the second gallery the pager itself shows an active link of page 2 and also the text Previous. Which is OK. But the same is displayed for the first gallery which isn’t paged. If you click on the Previous link there nothing weird happens but still it looks strange.
Rereading the documentation I tried an example with different mla_page_parameters (i.e. mla_paginate_current_2 and mla_paginate_current_3) to get a real solo paging effect for one gallery.
So I understand that the parameter name needs to be unique. That could be made clearer in the documentation.
I already read it somewhere that the myriad of possibilities of your plug-in could do with examples.
How about some examples in the documentation that only open up (with jquery) when the link is clicked? In such a case the documentation isn’t getting cluttered by all the displayed examples and if someone wants to have an explanation by looking at it (we are not all native English speakers you know….. ?? ) he/she can get it!Thanks for posting your continuing work and especially for the complete source text of your shortcodes. I think a simple change will resolve the problem you observed.
You have two paginated galleries, one for 2012 and one for 2011. Each gallery begins with an
[mla_gallery]
that displays the images, followed by an[mla_gallery]
shortcode with the pagination controls for the gallery.When I wrote “both of the shortcodes” in my earlier post I meant the shortcode that displays the images and the shortcode that creates the pagination controls. These two shortcodes have to agree on the name of their
mla_page_parameter
variable.In your example you have added
mla_page_parameter="mla_paginate_current_2"
to both of the pagination control shortcodes. You need to remove this parameter from the first pagination shortcode and add it to the second gallery display shortcode:<code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2012))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" ] </code> <code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2012))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" mla_output="paginate_links,prev_next"] </code> <hr/> <code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2011))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" mla_page_parameter="mla_paginate_current_2"] </code> <code> [mla_gallery post_mime_type='image' date_query="array(array('column' => 'post_date', 'year' => 2011))" post_parent=all orderby=ID order=desc posts_per_page=3 mla_debug=false mla_caption="{+post_id+}/{+post_date+}" mla_output="paginate_links,prev_next" mla_page_parameter="mla_paginate_current_2"] </code> <hr/>
I believe that will give you much better results.
Regarding the documentation issues, I am painfully aware that my documentation skills lag far behind my code writing skills. I know that MLA is powerful, but complex, and I wish there were more hours in the day for working on the documentation. I will keep making improvements as issues like this come up, and I do thank you for your thoughtful remarks and suggestions.
- The topic ‘Pagination pages all galleries displayed on page’ is closed to new replies.