Add filter for additional html in settings
-
localroutesParticipant4 years ago #14344
Hello,
to allow additional html, would it be possible to add a filter :
wpsolr-pro/wpsolr/core/dashboard/dashboard_settings/inc.php
line @686-689/**
* Load additional setting html.
*/
echo apply_filters(“wpsolr_content_after_label”, ”, $selected_val);localroutesParticipant4 years ago #14346The UI is quite complex and I would like to configure multiple searches
Instead of recreating the whole UI for integration with some custom fields
the filter makes it possible to add another setting for filters
A filter for sort and search would also be helpful
localroutesParticipant4 years ago #14347localroutesParticipant4 years ago #14351What I want is to use the UI you have made but add a couple options.
If I don’t have a filter then I will have to rebuild the whole UI or modify core to add the filter myself as in the example above.
wpsolrKeymaster4 years ago #14352ok.
Then please follow these instructions:
1) Install the latest version 21.6
2) Update wpsolr-pro/wpsolr/core/dashboard/dashboard_settings_inc.php with your new hook
3) Send me a download link containing a zip with the updated file, and a separate file containing a code example of how you use the hookI’ll then check if it fits with WPSOLR’s design.
localroutesParticipant3 years, 11 months ago #14428Hello,
I have added 2 filters
Purpose:
Add additional markup for includung fields in custom search
File: wpsolr/core/dashboard/dashboard_settings.inc.php
Filter added:
Line no: 742
echo apply_filters(“wpsolr_content_after_label”, ”, $selected_val);Screenshot:
https://prntscr.com/pe8efwPurpose:
Add additional field information on the search results page and in a map like latitude and custom fields.
File: wpsolr/core/classes/engines/class-wpsolr-abstractsearchclient.php
Filter added:
Line no: 2903
$data_result[‘additional_fields’] = apply_filters(‘wpsolr_filter_solr_results_additional_fields’, array(), $document, $wpsolr_query);Screenshot:
https://prntscr.com/pe8g7h
https://prntscr.com/pe8fsu
https://prntscr.com/pe8f89Link to files
https://drive.google.com/file/d/1jrIIRHeKqW2oAi4BXzTLCIgSNWpMTkuc/view?usp=sharing
localroutesParticipant3 years, 11 months ago #14474Hello,
have you had a chance to take a look?
wpsolrKeymaster3 years, 11 months ago #14476Yes.
Add additional markup for including fields in custom search
Your solution is to inject html in the facets admin page, to be able to add a custom option, here a checkbox.
But your code needs to know the internals of the page options data structure (at least the options name for the page), which is bad if the plugins data structure must evolve (and it will soon in fact!).
In your case, I do not think you need something as sophisticated. Just build an array in your code that associates the facet name with your option value.
But I recognise it would be nice, even for the plugin’s extension, to be able to extend the facets.
Something that would send the data, rather than the HTML, like:[ 'facet_name' => [ 'my-custom-field-name-1' => [ 'type' => 'checkbox', 'default_value' => false ], 'my-custom-field-name-2' => [ 'type' => 'edit', 'default_value' => '' ] ] ]
Add additional field information on the search results page and in a map like latitude and custom fields.
– Already existing: https://www.wpsolr.com/guide/actions-and-filters/search-results-modify-posts/
– Already existing: https://www.wpsolr.com/guide/actions-and-filters/search-results-append-html/- This reply was modified 3 years, 11 months ago by wpsolr.
You must be logged in to reply to this topic.