Title: Multiple reference in template
Last modified: September 16, 2021

---

# Multiple reference in template

 *  Resolved [coadr93](https://wordpress.org/support/users/coadr93/)
 * (@coadr93)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/multiple-reference-in-template/)
 * Hi. I am trying to achieve the following.
 * List all taxonomy terms from a custom taxonomy.
 * Exclude 1 particular term.
 * In the same query, list all posts from the excluded taxonomy term and mix them
   with the other taxonomy terms.
 * For context, i have cities (tax) and locations (post type). The cities with multiple
   locations are taxonomies, but the single locations are posts only (thus they 
   become cities in a way).
 * I’ve tried it in templates… But I can only reference either the post type or 
   the taxonomy.
 * I was thinking something like setting two tenplates with <.li.>, wrapping both
   in <.ul.> then order them alphabetically via JS… But it doesn’t seem very elegant.
 * Can you help? I can find nothing on the web regarding a WP query that mixes tax
   terms with posts.
 * Thanks
    -  This topic was modified 4 years, 10 months ago by [coadr93](https://wordpress.org/support/users/coadr93/).
    -  This topic was modified 4 years, 10 months ago by [coadr93](https://wordpress.org/support/users/coadr93/).

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [coadr93](https://wordpress.org/support/users/coadr93/)
 * (@coadr93)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/multiple-reference-in-template/#post-14878094)
 * Ok, here’s how I achieved it… but it’s not elegant at all 🙁
 *     ```
       <ul id="stocksymbols">
   
       [pods name="taxonomy_name_cities"]
   
       [if include_in_tax_query_custom_field]
   
        	<li>{@name}</li>
   
       [/if]
   
       [/pods]
   
       [pods name="post_type_name_location"]
   
       [if single_in_city_custom_field]
   
        	<li>{@name}</li>
   
       [/if]
   
       [/pods]
       </ul>
       ```
   
 * Then I used JS I found online to reorder the items Alphabetically, since they
   are all in the same UL.
 *     ```
       <script>
   
       function sortList(ul) {
         var ul = document.getElementById(ul);
   
         Array.from(ul.getElementsByTagName("LI"))
           .sort((a, b) => a.textContent.localeCompare(b.textContent))
           .forEach(li => ul.appendChild(li));
       }
   
       sortList("stocksymbols");
   
       </script>
       ```
   
 * So basically…
 * 1. I am querying the taxonomy terms and posts separately then merging them and
   reordering them via JS.
    2. To exclude one taxonomy I am using a Y/N custom field
   on taxonomies. This is also not elegant since I have to set all the terms I want
   to include to Y and the term I want to exclude to N. 3. To include only the posts
   inside the excluded taxonomy I am using another Y/N custom field.
 * I certainly hope there is a better solution to this…
 * So what I’m looking to achieve is Exclusion Rules (for the taxonomies) and Inclusion
   Rules based on taxonomy for posts…
 * I can live with sorting the <.li.> elements via JS.
 * Thank you and I hope you have some ideas.
    -  This reply was modified 4 years, 10 months ago by [coadr93](https://wordpress.org/support/users/coadr93/).
    -  This reply was modified 4 years, 10 months ago by [coadr93](https://wordpress.org/support/users/coadr93/).
 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/multiple-reference-in-template/#post-14893998)
 * Hi [@coadr93](https://wordpress.org/support/users/coadr93/)
 * Personally I would advice you to go the PHP route for this one. You can combine
   the results of your queries and reorder properly before running your loop.
    Pods
   templates aren’t meant for sunning complex queries, PHP is way more flexible.
 * Cheers, Jory
 *  Thread Starter [coadr93](https://wordpress.org/support/users/coadr93/)
 * (@coadr93)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/multiple-reference-in-template/#post-14894034)
 * Hey, Jory! Thanks for your reply.
 * Can you link me to any documentation that might be helpful for PHP pods template?
 * I’ve been browsing the pods.io website but mostly 404s or pages that have no 
   content…
 *  Plugin Author [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/multiple-reference-in-template/#post-14894040)
 * Sorry about the 404s, I’m working as quickly as possible to resolve the issue
   this week and get everything back up.
 *  Thread Starter [coadr93](https://wordpress.org/support/users/coadr93/)
 * (@coadr93)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/multiple-reference-in-template/#post-14894062)
 * Hey, Scott. Thanks! 🙂 You guys are doing a great job! I hope I will be able 
   to help at some point with the documentation but I’m still learning Pods myself.
 *  Plugin Author [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/multiple-reference-in-template/#post-14921934)
 * Just following up, this past weekend we spent days working on this and most of
   those 404s should be resolved.
 * We are not going to bring over the pods_api() docs because we will instead spend
   that time working on the new Code Reference site that is phpdoc powered. There’s
   too many methods to bring over and the process was very time intensive.
 *  Thread Starter [coadr93](https://wordpress.org/support/users/coadr93/)
 * (@coadr93)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/multiple-reference-in-template/#post-14922000)
 * Thanks for the update and for your work, Scott!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Multiple reference in template’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [coadr93](https://wordpress.org/support/users/coadr93/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/multiple-reference-in-template/#post-14922000)
 * Status: resolved