Skip Navigation

[Resolved] Toolset Shortcodes

This support ticket is created 3 years, 7 months 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 6 replies, has 2 voices.

Last updated by Pete 3 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#2020711
aa search bar.png

Hi there,

For a number of page templates we are creating, we need to use the Toolsetset short code.

I have tried various ways of presetting one of the drop downs to an area...like this for example:

[wpv-form-view name="home-page-search-bar" target_id="511" orderby="norfolk"]

Image shows the existing view search bar we already have, I don't wish to create a View for each of the 12 areas we have, rather use just one.

Is there a way, of using the short code method, to pre select the area to show by default.

Worth an ask. Thank you, Pete

#2021051

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Pete,

Thank you for getting in touch.

Not sure I understand fully but i'm assuming that you want to add this search bar to 12 different pages but have 12 different items preselected for that respective page ?

Please let me know if this is what you are referring to.

Thanks,
Shane

#2021055

Hey Shane,

Yep you got it. We have this standard search bar: hidden link
(Just under main hero image)

It comes with all our areas (Destinations).

Using a short code, can we have a specific destination pre-selected?

Thank you.

#2021099

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Pete,

It can be done but it would be tricky to achieve. Essentially you can get the field to be preselected by using the URL parameter.
hidden link

If you click the link above you will notice that the filter will be preselected to norfolk. Now if you're able to pass the URL parameter when you click to each of the pages then you can have the area preselected.

Meaning if you are Clicking to the Norfolk page, and want the view to have norfolk pre-selected then you will need to pass the URL parameter ?wpv-area=norfolk but on that button itself that clicks to norfolk the static parameter would be there.

This is the only way I see of doing it. For further clarification do you just want the filter to be preselected or is it that you want the view to actually be filtered with the results? Is there an example page ? We may be able to work around this using the hook below
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

Thanks,
Shane

#2021117

Hi again,

Yes we use this method: hidden link
To pre -select buttons and links so when clicked they end up on the Search Results page with the area reastults already displayed.

However, I guess for this to work on a 'page' we would have to have the page URL set to ?wpv-area=norfolk
If this the case we can't really do that, it's not great looking or ideal for Google.

Is this what you are suggesting ref using the URL param? Setting the page YRL to ?wpv-area=norfolk

#2021253

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Pete,

However, I guess for this to work on a 'page' we would have to have the page URL set to ?wpv-area=norfolk
If this the case we can't really do that, it's not great looking or ideal for Google.

That is correct if it to work on a page then it will need to be set in the URL parameter.
Is this what you are suggesting ref using the URL param? Setting the page YRL to ?wpv-area=norfolk

What I was thinking was to have a custom php filter that will pre-filter the listings based on the page that the view is on. Generally each page will have a different ID so we can use the PHP filter to pre-filter the list. The only problem is that the dropdown won't have the prefiltered value select because the URL is what sets this. The filter is listening out for the particular url parameter.

So if you want to have the list pre filtered but not have the dropdown preselected then we can do this with the filter query hook.

Let me know what you think of this.

Thanks,
Shane

#2022923

My issue is resolved now. Thank you!