Skip Navigation

[Resolved] creating select dropdown list of taxonomies

This support ticket is created 4 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 19 replies, has 2 voices.

Last updated by davidm-13 4 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1670299

Hi , What's the recommended way to create a select dropdown list from taxonomy field that when selected will open the custom post associated with selected taxonomy.
I'm new to Blocks, so a detailed explanation - or tutorial would be appreciated.
Thanks for any help

#1670643

So while you're on you weekend break (enjoy!) I've made some progress created a view with several search fields - for each taxonomy I want to search.
So now my questions are:
1. Where do I create the custom css class to add to a block element. (eg. the select dropdown boxes have 100% width. I want them to be around 30%)

2. How do I redirect to the custom post page for the selected taxonomy - at the moment the name is just selected - I want to open the page the taxonomy belongs to.

Thanks

#1671381
home1.JPG

So the attached image is a 2 column grid inside a container block. How can I add custom css to the container to adjust the width and positioning of the dropdown boxes and text.
Also need answer to question 2 above.
Thanks

#1671795

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Lets attend the issue one by one and solve them.

Regarding:
2. How do I redirect to the custom post page for the selected taxonomy - at the moment the name is just selected - I want to open the page the taxonomy belongs to.
- There is no native option available to using which you can redirect to the selected term archive page when you select the term from the taxonomy dropdown. As you are using views, views will update the results on the same page.

However, I've workaround to offer you where we need to add custom JS code using which we can redirect to the selected term archive page.

If you can share problem URL and access details I would be happy to assist you further.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1672477

Hi Minesh, Thanks for your help - if this option is not available in Toolset I have the possibility to insert the following HTML

<option value="<em><u>hidden link</u></em>">Aaronsohnia factorovsky</option><br/>
<option value="<em><u>hidden link</u></em>">Acanthus hirsutus</option><br/>
<option value="<em><u>hidden link</u></em>">Achillea arabica</option><br/>

This is just a snippet but you get the idea.
This is what I did on the on the home page - and want to redo it using Blocks - is there a way of inserting the above code into the <select> </select> on the page I'm requesting help with?

#1672533

Hi Minesh, I have a plugin "chosen for wordpress" which makes select boxes more user friendly and aesthetic.
I activated it with an HTML block containing only shortcode:
[chosen]
And it seems to work well

#1673207

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The thing is that - to display the associated archive, you need to create taxonomy archive from here and design your output as per your need.
=> hidden link

I've created the taxonomy archive and attach to taxonomy "Botanical Names", you can assign the same archive to multiple taxonomies.
=> hidden link
- You can add whatever fields you want to display within the Loop Editor section.

Then, I've changed the permalink to the postname:
=> hidden link

Now, you need to change the option value from:

<option value="<em><u>hidden link</u></em>">Aaronsohnia factorovsky</option><br/>

To:

<option value="<em><u>hidden link</u></em>">Aaronsohnia factorovsky</option><br/>

For your other taxonomy, please dont forget to change the taxonomy slug "botanical-name" in the option value.

Once you change all options to your associated taxonomy, you will notice that the page will redirected successfully to your the archive page.

#1673675
clicked-name-plant.JPG

Hi Minesh, Thanks for all your work and the detailed explanation. Unfortunately there was a misunderstanding, if you go to my site hidden link and select from any of the the lists of names it should take you to the plant custom post that that name applies to - try it!
I've restored the site from backup, if it would be possible to redirect to the relevant plant post (where the name appears) when one of the names is clicked, please let me know how.
Attached is a sample plant post that clicking a name on the home page should redirect to
Thanks

#1673737

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok - I've selected the option "aaronsohnia-factorovsky-warb-eig" from the first drop-down select and when I select it it took me on the following page:
=> hidden link

#1673859

That's correct - on hidden link are all the names - English, Arabic, Hebrew and the botanical names that the lists on the home page refer to, there's also other info - life form, habitat etc. and also buttons that take you to the medicinal uses of the plant. That's the theory, this is still a work in progress, but the idea is clicking on names in any of the lists takes you to the plant of that name. At the moment I've inserted all the <option value="plant's url"> manually, was wondering if it's possible to create the option url to redirect to the plant in code with Toolset.
Thanks

#1673929

was looking at this
https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/conditional-output-based-on-post-relationships/
Is this something I could use - create a relationship - to display plant with the selected taxonomy.
Or do I need to set all this up differently?

#1674537

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please tell me where you added the following code? as that code is throwing JS error.

<script>
jQuery(".test").chosen({
    search_contains: false,
    enable_split_word_search: false
});

Once you share that information, I will setup a small demo for you about how you can set the views and add filters to it so that you do not have to add the option values manually.

#1675393
js-chosen-err.JPG

Hi Minesh,
I'm trying to find the code, inspecting the folders, arrived to the attached but don't know where to find the code - any ideas?
Thanks

#1675463

chosen for wordpress is a plugin for styling <select> boxes, I've deactivated the plugin, and removed the shortcode [chosen] from the html, but I see the error is still occuring - don't know how to remove the problem code

#1676089

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I do not have any idea that is why I asked you to remove that JS code from your site. Can you please get back to me once you remove that code that I mentioned with the following reply:
=> https://toolset.com/forums/topic/creating-select-dropdown-list-of-taxonomies/#post-1674537