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

Option to force posts to use category image #1

Open
ryanhellyer opened this issue Feb 20, 2015 · 4 comments
Open

Option to force posts to use category image #1

ryanhellyer opened this issue Feb 20, 2015 · 4 comments

Comments

@ryanhellyer
Copy link
Owner

Provide a checkbox alongside the category image selector, to force posts to use the category image.

First mentioned here:
https://wordpress.org/support/topic/header-for-all-posts-within-a-category?replies=2#post-6593403

Code to do most of it, is here (requires editing of code comments, as some of them are wrong):
https://geek.hellyer.kiwi/plugins/unique-headers-single-posts/

@ryanhellyer
Copy link
Owner Author

Perhaps could have post randomly select a category on each page load.

Or it could have extra meta box appear on single post page which lets the user select which category the image should come from (perhaps not that user friendly).

Or it could just pick the first category's image (how the current extension plugin works I think).

It would also be nice to extend this to work with other taxonomies automatically too.

@ryanhellyer
Copy link
Owner Author

Current plan:

  • Add "Display on child posts" checkbox to the edit term page.
  • Post will check through each available taxonomy and look for a header image. Once it finds one, it'll stop looking and use that one.

Known major problems with current plan:

  • It could slam the database quite hard if it can't find a header image straight away.

Known minor problems with current plan (both of which I think are unfixable):

  • Dumb users may get ticked off when they add a post to a taxonomy and find that it picks up the header image from a different taxonomy due to them adding multiple taxonomies to a post.
  • Users may want a post to use a specific taxonomies header image, but it may default to another one.

@ryanhellyer
Copy link
Owner Author

Because of the problems listed above, it may be best to continue implementing this as an extension plugin, but better built, uploaded to the official repository and linked to within the core plugins plugin page.

@ryanhellyer
Copy link
Owner Author

I've implemented some of this as version 1.4 of the single posts plugin ... https://geek.hellyer.kiwi/plugins/unique-headers-single-posts/

Since it's an extra plugin, I didn't think the extra checkbox was necessary (due to not needing to worry about backwards compatbility) and so activating will automatically make the single posts pick up a header image if available.

To avoid serious load problems, I limited it to checking for 10 terms per taxonomy. After the tenth attempt, it simply gives up.

It will look through all available taxonomies and post-types automatically, not just posts/categories.

The performance is acceptable. If 10 terms are set per taxonomy, but no header image is set, and them are dozens of custom taxonomies set, then the performance of the site could lag a bit, but it won't crash the site. For sites where the header images are always set, the performance won't be effected in any m meaningful way. For sites where the header images are never set on taxonomies, but no custom taxonomies are present, the performance will be a bit shit, but the average user probably won't notice it. I haven't as yet figured out a way to work around these performance problems. It seems to be an inherent problem with accessing this type of data :/

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

No branches or pull requests

1 participant