-
Notifications
You must be signed in to change notification settings - Fork 32
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 conditional for CPT archives and CPT term archives #328
Conversation
Change to get queried object instead of category.
This could do with some tests. |
`is_archive()` is better in this case because it also targets taxonomy archives as well as custom post type archives.
It doesn’t change the functionality to have a custom post type or not, so to simplify we’ll remove that from the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the condition as you suggested, tweak the test method name as I've now added, and then this is good to land. Thank you Mikey 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor tweaks.
Co-authored-by: Gary Jones <gary.jones@automattic.com>
Description
When you register a custom post type with a taxonomy, the archive pages don't have the right metadata, they pick up the metadata from the first item in the loop instead of the main archive page.
What I'm trying here is adding the
is_post_type_archive()
conditional and switching to getting the queried object instead of just callingget_the_category()
as that doesn't work in all cases.Edit: I found that there's another case that I wanted to target: custom post type taxonomy archives. I've addressed that and added unit tests for that as well.
Fixes #327
Motivation and Context
Fixing this for custom post type archives
How Has This Been Tested?
Types of changes
Question: Should we also check if the post type is currently added to the Parse.ly options?