最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)

matteradmin7PV0评论

I have created some custom taxonomies (using WordPress Pods) and they work great - but there's just one thing that I need them to do, and here's my question:

How do I go about creating an archive template that can pull 'description' meta data into the custom taxonomy archive template?

get_term_meta

I understand that the template must contain "get_term_meta" but I am not sure how to get this going - is there an example that someone can point me towards - and is this a straightforward template to create?

BTW, I am 100% clear about the WordPress Hierachical Structure, it's just the PHP bit (the important bit) that I am not sure about.

Thanks

I have created some custom taxonomies (using WordPress Pods) and they work great - but there's just one thing that I need them to do, and here's my question:

How do I go about creating an archive template that can pull 'description' meta data into the custom taxonomy archive template?

get_term_meta

I understand that the template must contain "get_term_meta" but I am not sure how to get this going - is there an example that someone can point me towards - and is this a straightforward template to create?

BTW, I am 100% clear about the WordPress Hierachical Structure, it's just the PHP bit (the important bit) that I am not sure about.

Thanks

Share Improve this question asked Mar 26, 2019 at 11:46 HenryHenry 9831 gold badge8 silver badges31 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

I am unfamiliar with pods, but I use CPT UI quite a lot. Correct me if I am wrong, but I think in this case you could use the term_description() function. You can target the specific taxonomy using the two optional parameters: <?php echo term_description($term_id, "your_taxonomy_term_slug"); ?>

If so this could be a duplicate of: https://stackoverflow/questions/47841160/show-taxonomy-description-on-wordpress

I also found a closed GitHub issue about using get_terms_meta to get data from a Custom Taxonomy using Pods: https://github/pods-framework/pods/issues/5243

I know you said you were 100% on WP structure, however, for everyone else:

Archives file name examples in priority order:

taxonomy-your_taxonomy-term_slug.php

taxonomy-your_taxonomy.php

taxonomy.php

archive.php

index.php

Post a comment

comment list (0)

  1. No comments so far