Skip Navigation

[Resolved] Wrong site is being displayed in search result

This support ticket is created 6 years, 2 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.

Our next available supporter will start replying to tickets in about 1.00 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 7 replies, has 2 voices.

Last updated by ThorstenS967 6 years, 2 months ago.

Assisted by: Nigel.

Author
Posts
#1100844

Hi Nigel,
the following page displays the view for the events: hidden link
If you click on for example "Testveranstaltung" the content template of toolset is being loaded with my custom code (I know, I have to style it yet a little bit more ;-). Thats how it should work. The link is being generated with the code hidden link;">, so it's as dynamic link.
But if you click on the magnifying glass search icon on the top right in the menu bar and search for "Testveranstaltung" and you click on the search results link of "Testveranstaltung" he loads the static page instead of the dynamic one. Is it possible to fix this problem for the srearch results?

Thanks
Thorsten

#1101343

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Thorsten

The magnifying glass search is a standard WordPress search provided by your theme.

It displays the standard post results, linking to the individual post URLs.

To modify that you would need to edit the theme template used for the search results (there will probably be a search.php file). You would need to include some custom code in that to generate the links in the format you require.

Alternatively you could make a search View, including text search, with the results in your required format. You would need to insert that on a page, and then make some changes to your theme so that the magnifying glass linked to that search page instead of invoking the standard search as it does now.

#1101360

Hi Nigel,

ok. I use the Astra Theme. In the main Theme (not the Child-Theme) there is the "search.php"-file. I don't know if I would change something there, if this would break away when a theme-update happens.
Which of the both solution is the better/easier one? If I understood you correctly, there is custom code needed for both solutions. Which custom code do I need for either one of the solutions?
The site was built with Elementor and the the search widget (magnifying glass) is an Elementor widget.
I do also have the Relevanssi plugin, but I think this doesn't matter, right?

Thanks
Thorsten

#1101416

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

If you wanted to modify the search.php template you would copy it from the parent theme to the child theme and make your modifications there, then they wouldn't be lost by an update of the main theme.

But if your search comes from an Elementor widget, I would say the solution is fairly easy, you replace that with a simple html widget to display a link to a search page where you set up a search View that outputs the links in the required format.

#1101437

Ok, the second solution seems to be good. So you mean (please see attached screenshot) that I replace the Post Archive Widget in the Search Results Elementor Template with an HTML-widget that points to a view which outputs the search results?
I just trying another solution, but I don't know if it works. As you know, Elementor know supports Toolset. I created a Single Template with Elementor and set the CPT "Veranstaltung buchen" as Content Type and set the Conditions in Elementor Template as "Veranstaltung buchen". Now I thought that if you click on one of the events from the events Overview ( hidden link) that it would point to the created Single Template, but it doesn't. Do I have to modify also the view with the link?:

<a href="<em><u>hidden link</u></em>">[wpv-post-title]</a>

Also do I have to put the Shortcode from the Elementor Single Template

[elementor-template id="1759"]

into that link in the view? Maybe than I don't need to make the change with the HTML widget for the search results because it points to the Template?

#1101548

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I'm not sure I quite follow what you are doing with the Elementor templates, sorry.

But on your first point, no I did not mean you make any changes to the Element Search Results Template.

I meant that you stop using the Elementor search widgets (and the resulting search archive) because it will display the standard links to the custom posts, and not in the format you require with the event_id URL parameter.

You should *remove* whatever is responsible for the magnifying glass (I have understood this to be an Elementor search widget).

Instead you should place a link to a new search page (by all means use a magnifying glass for the link icon, but understand that clicking it will take you to the new search page, it won't open up a search dialog as it currently does).

Then on that new search page you insert a search View which you create, and which includes a text search input, and which outputs the results as links in the format you require (with the event_id URL parameter).

#1101638

Hi Nigel,
thanks for the explanation. I got another solution, that works partly right now. If you use the default search as it is right now and you search for "Testveranstaltung", he displays my Elementor Template, which I created with the dynamic fields from my Events-CPT. These are two videos, which describe what I'am trying to do/what I have done:
hidden link
hidden link
Now for the overview of my events (hidden link) he still points to the Page "Veranstaltungsdetails", which I used in Elementor and inserted a Toolset-Content Template. For this you helped me a view weeks ago with the view (hidden link) and helped me with the link to point to that page:

<a href="<em><u>hidden link</u></em>">[wpv-post-title]</a>

. But how can I achieve that this links refers/points to the Elementor Template, which I created? Is there a way to do this?

#1101670

Hi Nigel. Great News. I got it working. Instead of using:

<a href="<em><u>hidden link</u></em>">[wpv-post-title]</a>

I used

<a href="[wpv-post-url]">[wpv-post-title]</a>

.
Now he refers/points to the corresponding event in the event-view ((hidden link) as well as using the default WordPress search. 🙂
Anyway, thanks for your help. 🙂