How to Reverse Taxonomy Order

You can do this with the pre_get_posts action. pre_get_posts fires after the query variable object is created, but before the actual query is run. So you won’t suffer performance penalties by running multiple unnecessary queries. In your functions.php: add_action(‘pre_get_posts’,’xx_taxnomy_query’); function xx_taxnomy_query($query) { if ($query->is_main_query() && ! is_admin() && $query->is_tax(‘your_taxonomy’)) { $query->set(‘order’, ‘asc’); return; } }

Checking if a Page has an Associated Term?

Hi @NetConstructor: First thing, assuming your logic worked you can use the ternary operator to simplify your example: <li id=”kids-<?php echo is_term(‘Kids’,’age_groups’) ? ‘on’ : ‘off’; ?>”>Kids Programs</li> The issue seems to be that is_term() is used to check if a term exists, not if it is associated with a particular post. I think what … Read more

Custom taxonomy parent from another taxonomy

I was searching for an answer of the same question, and found a question on SE, that contains the answer: https://stackoverflow.com/a/40868654 In WordPress 3.7, released in 2013, a filter was added that allows manipulating the arguments, used to get the list of terms for the parent dropdown. The filter was also applied on the edit … Read more

Advanced custom fields – taxonomy terms images [closed]

OK had a go at this myself, I didn’t realise ACF was able to add fields to taxonomies which is really handy so I wanted to figure it out too. <?php $libargs=array( ‘hide_empty’ => 0, ‘parent’ => 0, ‘taxonomy’ => ‘library_categories’); $libcats=get_categories($libargs); foreach($libcats as $lc){ $termlink = get_term_link( $lc->slug, ‘library_categories’ ); ?> <a class=”single-library-cat” href=”https://wordpress.stackexchange.com/questions/71287/<?php … Read more

custom post type category page

Since you are using a custom taxonomy and not the native post categories you need to name your file taxonomy-{taxonomy}.php and in your case it would be taxonomy-mycategories.php Take a look at the section of the template hierarchy to display custom taxonomy archives.

Add Category Name to REST API

The API responses are designed to only return the IDs. You can then fetch the full information for each term. Of course it would not be very performant to make dozens of requests. So instead, the REST API has the concept of embedding resources. If you make your request, but include _embed=1 in your URL, … Read more

Using a different template per Custom Taxonomies for single term archive pages

I would intercept the template loader at template_redirect: function wpse53892_taxonomy_template_redirect() { // code goes here } add_action( ‘template_redirect’, ‘wpse53892_taxonomy_template_redirect’ ); Then, you would check to see if the query is a custom taxonomy: if ( is_tax() ) { // This query is a custom taxonomy } Next, get the term object, and find out if … Read more