Thanks for posting the source text. I copied it into my test system and made one small change – I added the my_custom-sql
to both of the pagination controls. It is important that all three shortcodes have identical data selection properties so they work off the same set of retrieved items. However, you don’t need the sort criteria in the pagination controls so my version of your shortcodes is:
[mla_gallery my_custom_sql='attachment_category=mobile orderby=date order=DESC' size=medium link=file columns=4 mla_caption='{+parent_title+}' mla_target='_blank' numberposts=40]
<div style="clear: both; float: left">
[mla_gallery my_custom_sql='attachment_category=mobile' posts_per_page=40 mla_output="previous_page,first" mla_link_text='← PREVIOUS' mla_rollover_text="Previous/first page"]
</div>
<div style="float: right">
[mla_gallery my_custom_sql='attachment_category=mobile' posts_per_page=40 mla_output="next_page,last" mla_link_text='NEXT →' mla_rollover_text="Next/last page"]
</div>
On my system these are working properly. The initial page displays the most recent images. Clicking the “NEXT” link gets the next-most-recent page of images, etc.
On the first page, clicking “PREVIOUS” just refreshes the first page because the parameter is mla_output="previous_page,first"
. If you code mla_output="previous_page,wrap"
instead, the PREVIOUS link from the first page will go to the oldest images (the last page). If you simply code mla_output="previous_page"
, the PREVIOUS link will not be shown on the first page. Similar options apply to the other control as well.
Since the sort order is descending, the “next” and “previous” terminology is a bit confusing. It might make more sense of you changed “NEXT” to “OLDER” and “PREVIOUS” to “NEWER”, so something like that.
If you don’t think orderby=date
is working (although it looks like it is working) you can try orderby=id
. That sorts by the ID value of the items. Since ID is assigned in increasing values for newer items, the results should be the same as sorting by date.
It’s possible that changing PREVIOUS/NEXT to NEWER/OLDER will clear things up. Let me know if that makes sense.