Home › Toolset Professional Support › [Resolved] some views display html without taxonomy content
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
Tagged: Views plugin, WordPress Archives
Related documentation:
This topic contains 14 replies, has 3 voices.
Last updated by BV 4 years, 4 months ago.
Assisted by: Minesh.
Hello!
Some views don't display at my website when similar views for other content type works fine. Both are almost similar.
Working example (attention, all links are NSFW):
hidden link
Scroll to the h3 header, Local Swingers Parties in Neighbour Places. All related links below display fine. That's for the Swingers Club custom type.
Example of the problem:
hidden link
Scroll to the h3 header, Hookup ads in neighbour places. No links below! If you'll look at html code - you will see that there are lists of that links but there aren't links between divs:
<div class="container wpv-loop js-wpv-loop"> <div class="row "> <div class="col-sm-3"></div> <div class="col-sm-3"></div> <div class="col-sm-3"></div> <div class="col-sm-3"></div> </div>
That custom type calls Hookup ad.
Problem pages are Hookup ads locations taxonomy archives (hidden link). I use the following code in the bottom of the template:
<h3>Hookup ads in neighbour places</h3> [wpv-conditional if="( [get_term_parent_id taxonomy='hookup-ads-location'] gt '0' )"] [wpv-view name="hookup-ads-location-in-neighbourhood-by-term-id" terms="[get_term_parent_id taxonomy='hookup-ads-location']"] [/wpv-conditional] [wpv-conditional if="( [get_term_parent_id taxonomy='hookup-ads-location'] eq '0' )"] [wpv-view name="hookup-ads-location-top-level"] [/wpv-conditional]
This is to start to follow the chain of views I use.
There are 2 things which confuse me:
- all the similar views/code works successfully for the Swingers Club custom type
- I tested "hookup-ads-location-top-level" at regular blog post - it works fine (actually I use almost the same view to display same links at the homepage and it works)
So looks like something wrong with displaying them at exactly that template.
Pls, help me to find out what is the problem.
I cloned the instance with a website, so here are the details:
[Credentials moved to private reply]
Both of the templates shows almost exactly the same, there are 2 if's.
Bottom of swingers club taxonomy archive:
<h3>Local Swingers Parties in Neighbour Places</h3> <br> [wpv-conditional if="( [get_term_parent_id taxonomy='swingers-clubs-location'] gt '0' )"] [wpv-view name="swingers-clubs-location-in-neighbourhood-by-term-id" terms="[get_term_parent_id taxonomy='swingers-clubs-location']"] [/wpv-conditional] [wpv-conditional if="( [get_term_parent_id taxonomy='swingers-clubs-location'] eq '0' )"] [wpv-view name="swingers-clubs-location-top-level"] [/wpv-conditional]
Bottom of hookups ad taxonomy archive:
<h3>Hookup ads in neighbour places</h3> [wpv-conditional if="( [get_term_parent_id taxonomy='hookup-ads-location'] gt '0' )"] [wpv-view name="hookup-ads-location-in-neighbourhood-by-term-id" terms="[get_term_parent_id taxonomy='hookup-ads-location']"] [/wpv-conditional] [wpv-conditional if="( [get_term_parent_id taxonomy='hookup-ads-location'] eq '0' )"] [wpv-view name="hookup-ads-location-top-level"] [/wpv-conditional]
They do 1 simple thing - display links to all taxonomy terms which is on the same level as the current one. So I retrieve them by 2 ways:
- if the current archive page represents the taxonomy term which is the root one (have no parent) - it retrieves the appropriate view, named *-top-level. That view through the loop display all terms which have no parent
- if the current archive page represents the taxonomy term which is not the root one (have parents), I retrieve current term parent id and then call view named *-by-term-id with that id. View filter terms which are children of that id
So everything is almost the same.
Jamal is on vacation. This is Minesh here and I'll take care of this ticket. Hope this is OK.
What if I can offer you another way to achieve this rather using conditional shortcodes where you will require to create two archives and we can switch/change the archive display based on if taxonomy term has parent or not - will that solution work for you? If yes:
You will require to create two separate archives and I will offer you the hook that will switch/change the archive to display based on the taxonomy term has parent or not.
Let's try it.
Ok - please create two different achives one for parent term and one for child term and share the link of those with me and access details and I will setup the hook.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Sorry, I don't get how to make separate templates for parent and child terms.
And, pls, consider that there are many levels of terms, not just 2.
BTW I don't understand why we are trying to discuss hooks or even my tags - when they are works in case of 1st taxonomy, and in case of 2nd taxonomy they work when you use them in other places, but don't work in case of exactly that place.
if there are number of different levels then the idea I shared will not be good to go.
So, Can you please share problem URL and access details (I checked access details you shared but its not working) and tell me what exactly not working and what is your expected output.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I checked - everything works fine, maybe you missed part about edit hosts file.
As about problem - I explained everything in posts:
https://toolset.com/forums/topic/some-views-display-html-without-taxonomy-content/#post-1740427
https://toolset.com/forums/topic/some-views-display-html-without-taxonomy-content/#post-1741893
Works fine - I mean, the access details I provided initially.
It seems that there is issue with the custom shortcode you wrote. As you can see with the following link:
=> hidden link
With both conditional statement you added - it returns the 0 hance the conditional does not match.
I suggest please check with the custom shortcode you added "get_term_parent_id" and check that it should return the correct value so that conditional statement should match as per your need.
Pls, just try to test any other view, try to include into this template ("Hookup ads locations"). Or create your own view and try to include it.
The problem is views not work in this template. It works at "Swingers clubs locations" archive template only, other WordPress archives templates show nothing instead of views.
Just try it .
Can you please check now: hidden link
With the following taxonomy view - I've added the [wpv-post-link] shortcode within the view's loop and I can see its working.
=> hidden link
<wpv-loop wrap="4" pad="true"> [wpv-item index=1] <div class="row "> <div class="col-sm-3"><li><small>[wpv-taxonomy-link]</small></li></div> [wpv-item index=other] <div class="col-sm-3"><li><small>[wpv-taxonomy-link]</small></li></div> [wpv-item index=4] <div class="col-sm-3"><li><small>[wpv-taxonomy-link]</small></li></div> </div> [wpv-item index=pad] <div class="col-sm-3"></div> [wpv-item index=pad-last] <div class="col-sm-3"></div> </div> </wpv-loop>
Can you please confirm it works at your end as well.
Ok, Minesh, it works! The problem is in local content templates (which is under "Templates for this View" title) - they not work by some reason, I did the same thing as you did for the "hookup-ads-location-in-neighbourhood-by-term-id" - I had to replace code in all views included to each other.
That's not a problem for me, but I would recommend developers of Toolset Views to debug it because problem isn't clear and and can be discouraging for some users.
My issue is resolved now. Thank you!