Theming of search results
-
StefanParticipant2 years, 12 months ago #35853
I am still evaluating the plugin. Search is working but i am struggling with styling the search result.
I use ‘use current theme search template with ajax. I render a searchfield in a template with get_search_form();
I created a template for each search result. But in that template I only have access to the WordPress Post data. But I do not want to show the post excerpt but the excerpt from the SOLR-result (so with the search-term highlighted.) Is there a way to access this from a template?StefanParticipant2 years, 12 months ago #35856In case my question is not clearly formulated, or this is the wrong way to get to the required result:
what i am trying to achieve, is a way to:
1. Add a search form to a template file that uses SOLR
2. Be able to style the results, preferably by using a WordPress template. But if it is only possible by using a twig template, that’s fine as well. An example of how to override result.twig would be appreciated.wpsolrKeymaster2 years, 12 months ago #35857WPSOLR replaces the query on all archives. Use your own archive WordPress template to show WPSOLR results:
https://codex.wordpress.org/Creating_a_Search_PageThe template shortcode delivered by WPSOLR is deprecated.
StefanParticipant2 years, 12 months ago #35858In my template that i use inside the loop, i use get_the_excerpt() and there is no highlighting there.
Also if i change it to get_the_content(), there is no highlighting.The query is set up like this:
$search_query = ‘something’;
$query = new WP_Query(array(
‘s’ => $search_query,
));
You must be logged in to reply to this topic.