Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
- This topic has 31 replies, 4 voices, and was last updated 11 years, 4 months ago by
Linda Everett.
-
AuthorPosts
-
12/12/2014 at 1:06 am #312722
David Rogers
ParticipantHi!
I’m trying to alter the chosen.js options when it’s called on the category dropdown. We are using the tile plus layout.
Is this possible by adding a tile-plus.min.js file to our theme in the following directory “theme/connections-templates/tile-plus” and adding options to the following code? “$(‘select[name=cn-cat]’).chosen();”
12/12/2014 at 10:32 am #312740Steven Zahm
Keymaster@ David
Yes … I just tested with cMap to confirm (same core logic is use to find and load files). So either of these should work fine:
../themes/{theme-slug}/connections-templates/tile-plus/tile-plus.min.js
../themes/{theme-slug}/connections-templates/tile-plus/tile-plus.jsOR
../uploads/connections-templates/tile-plus/tile-plus.min.js
../uploads/connections-templates/tile-plus/tile-plus.jsIf the core WP constant SCRIPT_DEBUG is set to false (default) and both files exist in the above path, the
minfile will load. If only one of the files exist in the above path, then the file found will be loaded.Of the two paths listed above, the theme folder would have a higher order of preference, meaning if the files exists in both locations, the version in the theme folder would load and not the version in the uploads folder.
The contents of the file … I highly suggest using
tile-plus.jsas your base and then change the following line with the Chosen option you want:$('#cn-tile-plus .cn-category-select.cn-enhanced-select').chosen();Hope that helps, let me know!
12/12/2014 at 1:59 pm #312749David Rogers
ParticipantHi Steven,
Thank you. I was successfully able to add tile-plus.js to our theme.
Our category dropdown has parent and child categories.
What I’m hoping to do is disable the parent categories in the dropdown, so that you can’t filter results with them. Chosen.js inherits “disabled” attributes if they are present in the original <select> on which it is called (http://harvesthq.github.io/chosen/options.html#attributes). Since I don’t have control over the <select> html, I was trying to add the disabled attribute with jQuery. If I inspect the <select> element, I can see that the attributes have been added, but I still seem to be able to select the parent categories.
Here is what I currently have in tile-plus.js
$(“#cn-tile-plus .cn-category-select.cn-enhanced-select option.cn-cat-level-1”).attr(“disabled”,true);
$(‘#cn-tile-plus .cn-category-select.cn-enhanced-select’).chosen();
If there’s a better way to disable parent categories, I’m open to that too.
12/13/2014 at 11:45 am #312770Steven Zahm
Keymaster@ David
I’ve never played with those Chosen options so I can’t really say. From the doc page it sounds like that should work exactly how you want. My thought is maybe the solect is being enhanced by Chosen before the the disabled attributes are set. I run into this type of thing all the time. You see the attr is called … but javascript does not wait for it to complete before moving to the next line. Kind of hack, but try chaining a small timeout before you init Chosen on the select.
Another option that should yield your desired result… an undocumented beta feature…
Add
enable_category_group_by_parent=trueto the shortcode so you have something like this:[connections enable_category_group_by_parent=true]12/16/2014 at 5:49 pm #312989David Rogers
ParticipantThanks Steven.
That option worked great.
One other question. Is it possible to re-order the dropdown categories? Right now, they are listed alphabetically.
Thanks!
12/17/2014 at 9:31 am #313013Steven Zahm
Keymaster@ David
Sorry, not, it’s not possible at this time. The taxonomy code is being revised so at some point this maybe added as a feature. The new code does already allow for a few different sorting methods. Actually the new category widget in the Widget Pack already uses this new code but I did not opt to include the sorting as as option. This new code will at some point next year be used throughout Connections so something like this will be possible. I’m not using it right now because it is much more db query heavy. This will not matter for the new category widget because it uses fragment caching so the extra db hits only occur once in awhile.
Hope that helps!
12/17/2014 at 12:56 pm #313024David Rogers
ParticipantHi Steven,
If you would considering adding this as a feature, we’d be happy to help fund it. Just let me know the approximate hours of your time it would take and your rate. Please let me know if that would be an option. =)
Thanks!
David
12/19/2014 at 9:35 am #313150Steven Zahm
Keymaster@ David
Maybe… what type of ordering do you need? The current beta code supports:
term_id | name | slug | term_group | parent | count
Honestly, even though the ode supports these fields, I don’t see how sorting by any other field that name would be useful.
12/19/2014 at 9:44 am #313151David Rogers
ParticipantHi Steven,
What we’re actually needing is manually ordering of the categories. To give a specific example, one of our categories is for the age range of a child. The options are:
PreK
K5
6th-8th
9th-12th
Higher Ed
OtherYet when Connections creates the category filter select menu and does an alpha sort, these are put into the following order, which no longer makes sense:
6th-8th
9th-12th
Higher Ed
K5
Other
PreKThanks for your help!
David
12/20/2014 at 2:46 pm #313209Steven Zahm
Keymaster@ David
I can think of a way to do this and incorporate it into a template, but … by explicitly setting a category order would mean explicitly including only the specified categories … meaning any category not set in the order would not be displayed. Does that make sense?
If you’d like to discuss funding this further, please use the contact link at the bottom of the page. Please make sure to paste a link to this forum thread so I can relate the two, thanks!
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.
