WordPress.org

Ready to get started?Download WordPress

Forums

Pods - Custom Content Types and Fields
[resolved] Taxonomy magic tags, and in the Pods shortcode (6 posts)

  1. maiki
    Member
    Posted 1 year ago #

    I am missing something, because in another support message, {@genres} supposedly outputs the terms. I've never gotten a magic tag to work for a taxonomy, and I've tried on four different sites. I must be missing something fundamental.

    Additionally, I am trying to list CPTs with a Pods shortcode, and I figured that I couldn't load a custom taxonomy inline, so I refer to a template instead. I can get all the other fields to show, with using magic tags or PHP, except for any taxonomy. Is that not happening at this point, or am I missing something there, as well?

    https://wordpress.org/plugins/pods/

  2. Josh Pollock
    Member
    Plugin Author

    Posted 1 year ago #

    Listing taxonomies isn't easy with the current version of Pods Templates, though that will change with the rewrite of that component that David Cramer is doing right now.

    For now, you should be able to get the first matching term from the taxonomy with {@NAME_OF_TAXONOMY} but to get all terms, you will need to open PHP tags and use get_the_terms() and loop through the results.

  3. maiki
    Member
    Posted 1 year ago #

    Yeah, the thing is, {@NAME_OF_TAXONOMY} does not work for me, at all. I've been trying to debug this, but I could never get that basic thing working, hence asking if in the referenced post, {@genres} produced output; it doesn't for me.

    I tested on four instances, all latest WP and Pods, and with no other plugins on. Is this a bug you are aware of? I can't find it in the issue queue.

    Related, ETA on that component David Cramer is working on?

  4. Josh Pollock
    Member
    Plugin Author

    Posted 1 year ago #

    What is the name of your taxonomy and what is the magic tag you are using?

    I do not have an ETA on the templates component rewrite. Some of it has been merged into the 2.X branch, so it should be present in 2.3.19. Some will have to wait until 3.0.

  5. maiki
    Member
    Posted 12 months ago #

    In two separate case, I have {@book_authors} and {@officers}. Neither of them return anything when I use them in an existing template, or an inline custom template, inside a Pods shortcode.

  6. Josh Pollock
    Member
    Plugin Author

    Posted 12 months ago #

    You should use get_the_terms. You can get the taxonomy terms like this <?php $terms= get_the_terms( $obj->ID(), 'book_authors' ); ?>. If you loop through the object that returns, you can get the name of each term, and if need be the ID, to pass to get_term_link.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic