As you can see we use the above code to fetch the current terms assigned to the "Area" and "Location" taxonomy of current page where we are displaying the view and we are passing the terms as tax_query argument so that it will filter the posts based on the current terms assigned to taxonomy "Area" and "Location" of current page.
Ahhh right, I see in some of the code the logic and what you are doing....that said i'm not great with this knid of code unless it's explained to me 🙂
Ok, it works great on the grid however, wee in the filter to the left, this isn't showing what's selected.
It defaults to All Norfolk for some season. Is this not going to work for the filter which ideally should have the selection 'Cartmel'...then the visitor can select somewhere else if they wish.
To select the current location option within the location filter, I've added the following code to the following view's "Search and Pagination" section at top:
=> hidden link
<script>
var clocation = '[wpv-post-taxonomy type="location" format="slug"]';
</script>
And within the JS editor of "Search and Pagination" section I've added the following code:
And I'v'e also change the "Custom Search" setting to " Always show all values for inputs" as you can see with the following screenshot that will allow you to select the other options within the "Location" dropdown filter.
=> hidden link
Appreciate your time. It certainly looks great however, I dare say, the filter isn't working at all.
If you select Guests, nothing happens. Same if you change Location.
Hey Minesh.
Yes I remember why I never liked using staging sites with Flywheel hosting, they are so slow it's dreadful.
Ok this all works GREAT....thank you so much.
What I would like, is for you to leave this with me and leave the ticket open.
I'll try and copy what you've done on a live site, if I get it wrong I'll just export the View and import it.
I'll test on a fully working site and then let you know.
It must be late where you are. And really appreciate your time and effort, it's very good of you.
I've added the following code to the following view's "Search and Pagination" section at top:
<script>
var clocation = '[wpv-post-taxonomy type="location" format="slug"]';
</script>
Where have you added this please? I have looked everywhere in the View and cannot find this.
Also I have had to give the Taxonomies slug a different name as they are already being used. So i have added feat-area and feat-location as the slugs for this. I have updated your code where I could see this needed doing.
Finally,
The pages have noting in the Area and Location.
So in the actual page there is nothing to select.
I have copied everything over however I must have missed something and can't work it out.
You must be doing this wrongly. You do not need to create new taxonomy but you just need to assign the existing taxonomy "Area" and "Location" to page post type.
If you can share you live site access details and I check and guide you in the right direction.
*** 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.
Yes I presumed I was doing something wrong. I actually restored the site back, before my changes and was going to attempt this again in a couple of hours.
I didn't make a new Taxonomy, the slug was the issue...it said it has already been used, which was odd.
Happy to give you access however was intending to try and do this again, after 12pm here in the UK, 4 hours time as I have contract to do till then.
I then will try again and if I hit issues, message you...that ok?
Or do you want access now?
Ok - Please make sure your "Area" And "Location" taxonomies are setup with the terms and assign the same "Area" and "Location" taxonomy to your page post type.
Then, Add/edit your and setup the terms for your "Area" or "Location" taxonomy that will be available on right sidebar when you are editing your page and add the view to that page and make sure to add the following filter to "Custom Code" section offered by Toolset.
=> https://toolset.com/forums/topic/one-view-for-various-pages/page/2/#post-1686389
[You need to change the view ID accordingly within the filter]
Please let me know if you need any help. I would like to solve this issue today 🙂
I have to do some work for some else this morning, will be in it in 4 hours time and get it sorted as best I can.
However, I remember for certain...when I went to Toolset > Pages > Taxonomies to add Area & Location.
The Area slug and Location slug was already taken, I had to add to this and then noticed much of your code required the slug...this is where I got confused.
You do not need to create new taxonomy rather use the same EXISTING taxonomy.
You just need to go to: Toolset => Post Types => Edit "Pages" post type and there you will see the section "Taxonomies to be used Page":
=> please check the following screenshot: hidden link
With that section, you will find the "Area" and "Location" taxonomy, you just need to checkmark the checkbox available with "Area" and "Location" taxonomy and save your page post type.
Now, whenevere you try to add/edit page post type post, you will see "Area" and "Location" taxonomy available on right panel.