Support » Plugin: Pods - Custom Content Types and Fields » Magic tag syntax to include (dynamic) taxonomy term from archive page?

  • Resolved awsamuel

    (@awsamuel)


    I’m trying to create a custom archive page, and have read and tried MANY approaches mapped out on these forums, but I haven’t been able to make anything work. I think my challenge lies in dynamically pulling the current taxonomy name as an argument in my pods shortcode.

    SETUP:

    • 2 custom content types: “Characters” and “Fandoms”
    • 3 custom taxonomies: “Identity”, “Genre”, “Medium” (each associated w/both custom content types)

    I’m using the Divi theme and a plugin called Taxonomy Layout Injector. I built a tabbed layout in Divi and assigned it as my layout for taxonomy archive pages. One tab contains a shortcode that pulls in my Fandom Pods; the other tab contains a shortcode that pulls in my Characters pods.

    I get the outcome I want when I declare a specific term from within my custom taxonomy as the filter for the results in my PODS template:
    [pods name=”character” limit=”10″ template=”Character list template” where=”identity.name=’youth'” ]

    But I would have to hard code each “identity-name” term, and build my archive pages manually, to make this work, so there are many reasons that is not a good approach.

    I have tried a lot of different approaches to accessing the current taxonomy term so I can build something like “identity.name=’DynamicallyGeneratedCurrentTaxoTerm'” but I think I’m missing the subtleties of Dynamic Magic Tags — or perhaps I need to do this in my PODS template (except: the template belongs to the pod, not the archive page, so does it even know which taxonomy term we’re on?) or maybe even in an archive.php file (which one?)

    I’m not sure if the issue is what I’ve used to access the taxonomy term (I’ve had no luck with single_term_title) or in my syntax (I’ve had a hard time understanding how to formulate “where” queries with “IN”, and also, still don’t quite have a handle on how to structure Special magic tags if I’m trying to invoke a WordPress Template tag like single_term_title.

    I understand that taxonomy is an array and that there are multiple terms associated with any one pod item, which is why i was trying to pull the term directly from the archive page itself, either via single_term_title or by looking within the archive page title, which as currently constructed DOES include the taxonomy term for the whichever archive page you’re on.

    I’m hoping someone could help me figure out:

    1. If there’s a way to adjust the shortcode above, repling <i>youth</i> with a magic tag that dynamically pulls in the taxonomy term from the archive page
    2. Alternately, point me in the direction of a PODS template or archive.php fix — if the latter, I think I may need a bit more handholding because even though I’m no stranger to messing around in WordPress PHP files, I’ve felt quite lost by the explanations I’ve found on PODS.io — I think because it’s a little hard to know which version any post maps onto.

    I’m afraid the site is currently on a production server without any straightforward way of providing external access but I can provide a password-based workaround (just not on a public forum).

    Thanks in advance for any help folks here can provide!

    Alexandra

    And in case it’s relevant, here’s the Character list template my shortcode pulls in:
    <div class=”character-list-template”>

    {@chara_name} ({@parent-fandom})
    <span class=”identity-terms”>[each identity]
    {@name}
    [/each]</span>
    <?php echo $obj->display( ‘single_term_title’ ); ?>
    <br>
    </div>

Viewing 1 replies (of 1 total)
  • Plugin Author Jim True

    (@jimtrue)

    We actually worked this one on our Slack Chat. Unfortunately the answer is more complex than the the question since it required a lot of additional discussion. This happens often 😉

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.