Site logo

Archived topic

Search Result Page - Links to the Page with the Results

5 replies · Started by Michael on April 28, 2020

Viewing posts 1–6 of 6

Hey there

I didn´t find a solution yet.
I´m not sure if this is possible. I use two plugins to "pimp" the WordPress search.
Ivory Search and Relevanssi.

My question: is it possible to add a link to every entry of the search results page given for a specific search word so the viewer can visit the page where the search word appears?

Example: I type "geografie" and press enter. Now it redirects me to the search page. There are 3 results. At the moment it´s just text. I want to guide the user to the page where the search word is.

Can I achieve this with a GP filter?

Thank you
Best regards
Mike

Hi there,

Unfortunately I'm not aware of a solution like this.

Sounds like it would require a custom solution with some decent amount of coding.

Sorry about that!

Hey Leo

Thanks for your answer.

I guess I asked way to complicated.
I found a solution. What I was looking for is basically a customized search template in a child theme.

To solve my problem I just created a GP child theme and tweaked the search.php file with that code:

<?php while ( have_posts() ) : the_post(); ?>
            		<h3 class="s-h3"><?php the_title(); ?></h3>
            		<a class="s-a" href="<?php the_permalink(); ?>"><?php the_permalink(); ?> »</a><br><br>
            	<?php endwhile;

It is working but at the moment every search result in other languages than German redirect me to the German search results page.

I use polylang with a German, French and Italian version. When I do a search in the German version everything works fine. But when I do a search in the French or Italian version, it always redirects to the German search results page with the message - no results found.

Do you have an idea on how I can fix that redirection bug? If not it´s totally fine. It could be some compatibility issue with the "Ivory Search" plugin.

Thanks

Yea, that might be something you need to bring up with the search plugin. Sounds like there might need to be a tweak with the query so it respects the language.

Glad you figured out the template - did the default template not have the title linked to the post?

Thanks Tom

I had to deactivate the Ivory Search plugin. Then it worked again.

No, the default template only had the_content without title and link to the page of the search result.

The settings in the layout > blog > archive didn't work for me.
I will let you know later if I can replicate it on a test site so you know if it would be a small bug.

That's weird, feel free to link me to an example if you ever find the time.

This archived topic is closed to new replies.