Forums › Forums › Search & Filter Pro › How to style the search data
- This topic has 29 replies, 2 voices, and was last updated 9 years, 3 months ago by
Anonymous.
-
Anonymous(Private) April 22, 2016 at 11:01 am #43630
Thanks for this code, I had to adjust the code to add extra closing brackets for the STRING (below), unfortunately this results in the same data being given.
“Yacht Length: 40-50m”
<?php
global $searchandfilter;
$sf_current_query = $searchandfilter->get(339)->current_query();
echo $sf_current_query->get_field_string(“_sft_length”, array(“str” => “%2$s”));
echo $sf_current_query->get_field_string(“_sft_rate”, array(“str” => “%2$s”));
echo $sf_current_query->get_field_string(“_sft_guest”, array(“str” => “%2$s”));
echo $sf_current_query->get_field_string(“_sft_location”, array(“str” => “%2$s”));
echo $sf_current_query->get_field_string(“_sft_toy”, array(“str” => “%2$s”));
?>Trevor(Private) April 26, 2016 at 10:44 am #43915Ok.
So, this is the code I made:
global $searchandfilter; $sf_current_query = $searchandfilter->get(339)->current_query()->get_array(); foreach($sf_current_query as $key) { echo '<div>' . $key['active_terms'][0]['name'] . '</div>'; }
If you wanted to put the X before each, replace the echo line with something like this:
echo '<div><a id="executeMyCodeLink" href="#">X</a> ' . $key['active_terms'][0]['value'] . '</div>';
Where the code to add to the page would be something like this
<script> $('#executeMyCodeLink').click(function(event) { /// Your code here }); </script>
But that is beyond the scope of what I can do easily 🙁
Trevor(Private) April 26, 2016 at 11:02 am #43922Notice how I put some divs in there, so you can add a style class and style it how you want. I am sure that there will be a way to do the js.
It would work like this, is my guess.
Set the form element back to default value and then re-submit the form.
Anonymous(Private) April 26, 2016 at 11:58 am #43933Hi trevor,
Sorry, hopefully a quick question:
How do I change the search data being shown from the taxonomy slug to the taxonomy name?
For instance, it is currently showing “2000-pw” but this is the slug for the term “£2000pw”.
I assume this is just changing “[value]” but I don’t know what to.
Thanks
-
AuthorPosts