Get listing and vendor categories and attributes

I was wondering how to get the categories and attributes for a listing or vendor in different situations. There are at least two situations where I would need them: (1) when using custom shortcodes on a listing/vendor page and (2) in general functions.

(1) I’ve created shortcodes that I am using on listing or vendor pages and I would like to use the listing’s/vendor’s categories and attributes in the shortcode function. What is the best way to get these? When on a listing page, is there already a listing object that I can use?

(2) How can I get the categories and attributes of a listing/vendor in functions that run outside of a listing/vendor context? I assume I would need to get the ID first to create a listing/vendor object and then get the categories/attributes?

It would be great if you could give some examples of how to achieve this elegantly with the hivepress API …

Thanks guys!

Please describe an example with a code snippets that you want to use. It’s possible to get the listing and vendor objects from the current context but this depends on the use case, e.g. some hooks pass listing IDs or objects to the callback functions.

Hi ihor, ok – thanks. I’ll check my code and come back with a few examples.

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