Hi,
I need to display in a View certain characteristics(taxonomies) of a CPT called Profile.
For example:
One taxonomy called Sports and its terms: Swimming, Running, Cycling, Baseball, Basketball and Tennis,
What I want to display:
Sports that I practice and I don't:
- Swimming (yes)
- Running (yes)
- Cycling (no)
- Baseball (yes)
- Basketball (yes)
- Tennis (no)
(instead of "yes" or "no" a glyphicon or mark with a check or "x")
*It is important to display Sports that profile does not practice.
Resources that I visited:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/displaying-taxonomies-conditionally/
https://toolset.com/documentation/user-guides/displaying-wordpress-term-fields/
https://toolset.com/forums/topic/showing-only-the-parent-taxonomy-and-showing-term-fields-in-a-content-template/
https://toolset.com/forums/topic/display-taxonomy-terms/
Hi, I can help you with this.
- Create a View of the Sports taxonomy called "All Sports Terms", and use the "Full custom display" option in the popup.
- Scroll down to the Loop editor and click "Loop Wizard". Create an unordered list display, and display the taxonomy title field.
- Exit the wizard and the loop will be generated automatically. Place this View in your Profile template as a test, and confirm that the taxonomy term titles are displaying as expected.
- Create a View of Profile posts called "Profile Term Glyph", and use the "Full custom display" option in the popup.
- Add a Query Filter by post ID, set by a shortcode attribute "ids"
- Add a Query Filter by Sports taxonomy term, where the term slug set by a shortcode attribute "terms" (see query-filter.png for an example)
- In the Loop Editor, click Skip Wizard. In the wpv-loop tags, type "YES" and in the wpv-no-items-found shortcode type "NO". The loop editor code will look like this:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>YES</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]NO[/wpv-no-items-found]
[wpv-layout-end]
- Place this View inside the loop of the View of Sports taxonomy just after the taxonomy title shortcode, and set the ids and terms attributes like this:
[wpv-view name="Profile Term Glyph" ids="[wpv-post-id id='$current_page']" terms="[wpv-taxonomy-slug]"]
- This technique is called passing arguments to Views, and we have more information about it here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/
Let me know if you are able to get this far, and then we can work on adding a glyphicon next.
Hi Christian,
Great! I followed your very clear instructions and was able to obtain the expected results.
I'll wait for further instructions in order to display glyphicons instead of "YES" or "NO".
Thank you once again for your support.
After the excellent support of Christian I just replaced the word "YES" and "NO" (respectively) in All Sports Terms View with something like this:
<span class="glyphicon glyphicon-ok-circle">
<span class="glyphicon glyphicon-remove-circle no_glyphicon">