• Resolved birrwerk

    (@birrwerk)


    Hey,
    is there a way to list the category from current post?
    I have tried the following code but it don’t work.

    [select post-category]
    [cf7-recordset id=”category-terms” type=”taxonomy” taxonomy=”listing_category” condition=”ID={post.id}” attributes=”term_id,name”
    ]
    [cf7-link-field recordset=”category-terms” field=”post-category” value=”term_id” text=”name”]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @birrwerk

    Thank you very much for using our plugin. In this case, you must read the information from the database:

    [select post-category]
    
    [cf7-recordset id="category-terms" type="database" query="SELECT t.term_id, t.name  FROM {wpdb.terms} t JOIN {wpdb.term_taxonomy} tt ON(t.term_id = tt.term_id) JOIN {wpdb.term_relationships} ttr ON(ttr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.taxonomy = 'listing_category' AND ttr.object_id = {post.id}"]
    
    [cf7-link-field recordset="category-terms" field="post-category" value="term_id" text="name"]

    Best regards.

    Thread Starter birrwerk

    (@birrwerk)

    Thanks for the very fast reply.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Category from current Post’ is closed to new replies.