• Hi,

    I’d like to create a single taxonomy to connect and display as groups on frontend wp posts, bbpress topics, woocommerce products, wp job manager jobs, etc.

    Tips appreciated!
    Thanks

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter Zync

    (@zync)

    Thanks, I have this plugin installed https://wordpress.org/plugins/custom-post-type-ui/.

    So if I understand correctly, custom posts enable grouping and displaying groups of items, in wordpress and other plugins?

    Moderator bcworkz

    (@bcworkz)

    custom posts enable grouping and displaying groups of items, in wordpress

    Correct. As for plugins, it depends on the plugin, any particular plugin may or may not recognize your post types.

    Taxonomies also do the same thing, though they are conceptually different. You can associate different taxonomies with different post types, but associating different post types with one another gets more tricky.

    To a great extent, anything is possible, especially when term meta becomes available in 4.4 (already available via plugins). It’s more about what makes sense to you. However you wish to organize elements of your site, there is likely a way to do it.

    Thread Starter Zync

    (@zync)

    From a conversion point of view, wouldn’t that be the first thing a publishing blog would need? Cross-reference different types of content website wide? Like ‘Related’ by hand.

    Moderator bcworkz

    (@bcworkz)

    I imagine so. For most people a single post type with categories and tags suffices. One can go a long way with just that if they are clever. I think the reasoning is if you are capable of making custom post types, then you are capable of linking them together in some manner. The intention is linking through a taxonomy, but potential exists in post meta as well. If necessary one could create one or more pivot tables for incredibly complex relationships. There’s infinite potential, you’re only limited by your coding and DB design skills.

    Thread Starter Zync

    (@zync)

    I see lots of ways by hand, to link to relevant jobs or products from inside posts. It just strikes me as strange to silo your content apart from wp posts.

    Thanks a lot, I will keep revisiting this subject till hopefully something robust comes my way.

    Thread Starter Zync

    (@zync)

    I suppose a woocommerce product cannot be a ‘post type’?

    Moderator bcworkz

    (@bcworkz)

    It can, and it is! Custom post type “product”. You can verify by examining the posts table with phpMyAdmin or similar. It has several taxonomies associated with it, like “product_cat” and “product_tag”.

    The relevant code is certainly in the plugin somewhere, but I couldn’t begin to even guess where it might be.

    Thread Starter Zync

    (@zync)

    Thank you for your patience, I really want to choose the right architecture from the get-go.

    So, post-types have certain ‘placeholders’ for common post-types like ‘products’, from whatever commerce plugin.

    To get that feed, I need to search the source plugin for code to embed in “product_cat” and “product_tag” of the taxonomy.

    Am I wrong in assuming then, the taxonomy can pull in any feed from any plugin? It’s like an open api that harmonizes output.

    Moderator bcworkz

    (@bcworkz)

    I’m not sure what you would really gain by searching plugin code other than confirming what I already told you. As long as you trust me there really isn’t any need 🙂 I was only suggesting that it’s possible to verify this independently, not that you must actually do so. My understanding is that you want to be able to query for products using the associated taxonomies in some manner that is not already offered by the plugin. I’ll try to explain how these work.

    First, in order to use any particular taxonomy with any particular post type, it must be registered to be used that way with register_taxonomy_for_object_type() OR by registering it when the post type is first registered OR when the taxonomy is first registered. Naturally, the Woo plugin has already done all of this for the taxonomies and post types it creates. This paragraph is just in case you want to add other taxonomies or post types into the mix.

    If the above registrations are done properly, I believe any query for a particular taxonomy term is supposed to return all objects that have that term assigned to them, of any of the associated post types. I haven’t set up a relationship like this in a while, but I recall this does not always happen as it should and we need to hook ‘pre_get_posts’ and explicitly add in the desired post types to the ‘post_type’ query var array. You’ll find out whether this is necessary or not soon enough.

    So you shouldn’t need to find any particular plugin code as long as you know (or take my word for it) the proper post type and taxonomy slugs needed to form a query. As long as the query is properly formed, you will get the desired results. In most cases manipulating query vars from ‘pre_get_posts’ is all that’s required, if even that.

    You are wise to want the right architecture from the start. Finding out after there’s thousands of entries that it should have been different can be a real chore to fix! Take your time and be sure you understand what your options are. I’m happy to help in any way I can for as long as it takes.

    Thread Starter Zync

    (@zync)

    Great confirmation actually what I’m looking for.
    In a weeks time I’ll have enough content in place to get final requirements, but this is the configuration we need, I thank you so much for taking time.

    I’d love to revisit the subject and show you the definitive setup.
    Till then thanks again and keep up your great work!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘single taxonomy for all blog items’ is closed to new replies.