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

Add order by and posts_per_page for taxonomy archive queries #9

Open
bobbingwide opened this Issue Feb 17, 2017 · 4 comments

Comments

Projects
None yet
1 participant
@bobbingwide
Copy link
Owner

bobbingwide commented Feb 17, 2017

Similar to the change in 44807de, where we provide archive sort and archive posts per page fields, we now require the ability to control what happens on taxonomy archives such as "letter" and "api_letters".

The whole point of having letter selection is to find the contents quickly, so we need to be able to display quite a few per page.

@bobbingwide bobbingwide self-assigned this Feb 17, 2017

@bobbingwide

This comment has been minimized.

Copy link
Owner Author

bobbingwide commented Feb 17, 2017

Workaround

The current logic in oik_types_pre_get_posts_for_archive attempts to determine the post_type for the query. This defaults to post. So for taxonomy archives we can set the archive_posts_per_page for post to be 102 ( divisible by both 2 and 3 ).

@bobbingwide

This comment has been minimized.

Copy link
Owner Author

bobbingwide commented Feb 18, 2017

The orderby still needs to be addressed.
For letter taxonomies, if it's not easy to provide an admin interface in oik-types, then this may be better achieved in the implementing plugin(s).

@bobbingwide

This comment has been minimized.

Copy link
Owner Author

bobbingwide commented Mar 13, 2017

Proposed solution

For the workaround to be effective it 1. Actually needs to be implemented 2. Should produce a reasonable result on the home/ blog page.
A better solution would be to detect that it's an is_tax() or is_category() query and then use the max. value for any post type associated to the taxonomy.

@bobbingwide

This comment has been minimized.

Copy link
Owner Author

bobbingwide commented Mar 14, 2018

One year on... the logic in oik_types_posts_orderby() is OK for taxonomies where we do want to display posts ordered by title, but produces unexpected results for blog posts.
This was noted on WP-pompey.org.uk and has been raised as an issue in wppompey/wp-pompey#4
for potential investigation in tomorrow's WordPress Portsmouth Meetup Clinic.

The "temporary" solution implemented in oik-types should be revisited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment