Tokens to display subcategories

Hi guys! I’ve figured out tokens to display listing titles almost exactly to my needs simply by trying. Right now I am using “%listing.tags% at %listing.categories% #%listing.slug%” which is fine but not great. By using tokens in Hivepress, is there a token to only display the subcategories/ skip the highest level? Otherwise we would have to use custom coding since with this current token, the titles get to big. We have our listings under four big umbrella categories, and then about 15 single subcategories. Thank you.

Hi,

Please note that by default, the listing is assigned the most child category, so I recommend clearing the cache, disabling your customizations, and then testing again.

Yes, I am aware. In the backend, we can check both the umbrella and subcategory which is what we need. This token will then display all categories that are checked, not just the most child, which would be perfect! Furthermore, when users create listings in the frontend, it only checks the most child category, which is unfortunate for our use case. We do need both the umbrella and child to be selected.

I could also live with a solution where I can show the parent category in an attribute field, and then only use child categories for creating listings.

Hi,

Unfortunately, there is no such function, since the form listing has a completely different logic, it will require a custom implementation. Also, another option is to manually put categories through the backend after moderating the listing, but note that you may have broken counts, because it will be counted 2 or more times, depending on the levels.

Thanks. This helps to know. Would you be able to support me with a snippet to enter the parent category name in an attribute field named “parentcategory” on the create and update hook?

Hi,

Sorry, there’s no simple code snippet for this, it would require a custom implementation. If customizations beyond the available features are required for your site, please consider hiring someone for custom work https://fvrr.co/32e7LvY

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.