Skip Navigation

[Resolved] How to use the same content template for both pages but in different results?

This support ticket is created 4 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

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)

This topic contains 6 replies, has 2 voices.

Last updated by Minesh 4 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#1553063

I duplicated the homepage Builder template hidden link to hidden link.
I want to use the same views hidden link for both pages but I want different result using Taxonomy filter. I don't want to make another view since we have plan to make another page like this and it's not ideal for us to make another views everytime we make pages like this.

For example:
- In homepage hidden link, at search box area hidden link In the result should not be include the "Spa/Massage" custom taxonomy.
- In hidden link, I want to display the result of "Spa/Massage" Taxonomy only.

I tried this method https://toolset.com/forums/topic/filter-taxonomy-with-shortcode-attribute-and-specify-not/
also, I tried this shortcodes
[wpv-form-view name="homepage-listings-search" target_id="17825" wpvcategory="spa-massage" ] and
[wpv-view name="homepage-listings-search" wpvcategory="spa-massage"]

#1553079

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Filtering your view by shortcode attribute where you can pass the view's argument as shortcode attribute wpvcategory="spa-massage" will allow you to either set the filter to include term or exclude a term.

So, if you want to filter you view with different terms where you want to display the posts attached to that terms, you can re-use the view by passing shortcode argument's different values:

For example:

[wpv-view name="homepage-listings-search" wpvcategory="spa-massage"]
[wpv-view name="homepage-listings-search" wpvcategory="other-massage"]

where:
- the first view will display posts attached to spa-massage and the second view will display the posts attached to other-massage.

More info:
=> https://toolset.com/documentation/user-guides/views/passing-arguments-to-views/#controlling-the-filter-with-shortcode-attributes

Please note that this will pre-filter the results before the results will be displayed on the page.

To use the same view where you want to allow and disallow by passing the same taxonomy term using shortcode attribute - you need to change the view's query argument only using the view's filter: wpv_filter_query.
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

If you agree - I can setup a demo example for you and for that I need temporary access details of your site.

*** 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.

#1553291

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've adjusted the filter for the taxonomy to filter with shortcode attribute as you can see with the following screenshot:
- hidden link
=> hidden link

And called the view as given under:

[wpv-view name="homepage-listings-search" target_id="17825" wpvlistingcategory="spa-massage" ]

I can see now - it shows the results as expected: hidden link

#1553441

Thanks I see it working but I want the result to display on hidden link like homepage search result.

And how to filter if you don't want to include the "massage/spa" taxonomy to my homepage results?

#1553477

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thanks I see it working but I want the result to display on hidden link like homepage search result.
==>
I do not get what you mean, what exactly you want to display where?

And how to filter if you don't want to include the "massage/spa" taxonomy to my homepage results?
==>
If you do not want to include the results for the taxonomy term you passed as shortcode attribute, in that case, you will not be able to use the same view.

You should simple duplicate your view by clicking of the Duplicate link with the view you want to duplicate
=> hidden link

Edit your duplicated view and edit your taxonomy query filter to "Not one of those values" and save your taxonomy filter:
=> hidden link

#1553495

I do not get what you mean, what exactly you want to display where?
=> I mean if you search and click the Discover button on homepage the results will go to results page which is hidden link.

"If you do not want to include the results for the taxonomy term you passed as shortcode attribute, in that case, you will not be able to use the same view."
=> I got it what you mean.
there isn't shortcode for that?

#1553525

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

hidden link
The thing is that - you are displaying the search form and search results (both) with the above link. Do you want to display only the search form?

there isn't shortcode for that?
==>
No, there is no shortcode to change the filter settings.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.