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

Return terms if no associations are made #6

Open
jamiemchale opened this issue Dec 12, 2011 · 4 comments
Open

Return terms if no associations are made #6

jamiemchale opened this issue Dec 12, 2011 · 4 comments

Comments

@jamiemchale
Copy link

If the 'taxonomy-images-get-terms' filter is used when there are no associations between taxonomies and images then no terms are returned.

Could this return a list of terms with '0' as the image ID so that the theme can switch to a default generic image?

Of course, the other way to handle this is to check for an empty array and then just use get_terms in the theme - but I think that returning a list of terms is expected behaviour, and means fewer steps in the theme

@mfields
Copy link
Owner

mfields commented Dec 12, 2011

Have you tried setting the "having_images" arg?

having_images (bool) If true, the returned array will contain
only terms that have associated images. If false, all terms
of the taxonomy will be returned. Defaults to true. Optional.

@jamiemchale
Copy link
Author

Just to ensure that I have the syntax correct:

$terms = apply_filters( 'taxonomy-images-get-terms', '', array( 'taxonomy'=> 'types', 'having_images' => false ));

Even without the having_images setting - if the 'taxonomy_image_plugin' in the options table is blank then no images are returned. If there is something in the options table then my taxonomies are returned even if they don't have images associated with them.

Ln 90 of public-filters.php checks to see if the associations is empty - and if so returns a blank array. Should this check for an over-ride?

@mfields
Copy link
Owner

mfields commented Dec 17, 2011

I'll need to test this. From the sound of it, I think that there is a bug in the code :( Sorry about that. Please do not submit a pull request though ... I'll be rolling back a few of the changes that are here on Github ... I went a little crazy with a few things and need to revisit them before the next version. Thanks for pointing this out!

@jamiemchale
Copy link
Author

No problem - if you need more testing help then please do ask. Thank you for your work on this!

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

2 participants