Hi,
i would like to show in the result's view of a parametric search a title with the current taxonomies.
I just made it work via the search term like this:
[wpv-conditional if="( '[wpv-search-term param="wpv-zona"]' )"] in zona [wpv-search-term param="wpv-zona"][/wpv-conditional]
In this way it shows the zone from the query term. Is there any better way to implement this type of work ?
i would like to show in the result's view of a parametric search a title with the current taxonomies.
I assume you mean the taxonomy terms selected in your search form filters, correct? The wpv-search-term shortcode is the best way to access a search form URL parameter using Views shortcodes. You could probably make a more customized display of the terms using a custom shortcode, but what you've got here is probably a good start.
You could probably make a more customized display of the terms using a custom shortcode
How can i make a more customized display of terms?
what do you mean?
may i have an example ?
thank you
How can i make a more customized display of terms?
You can make it using custom PHP code, possibly a custom shortcode. If you're not aware of how to use the WordPress Shortcode API, you may need the assistance of a professional developer.
https://codex.wordpress.org/Shortcode_API
what do you mean?
I mean if you want to display anything other than the defaults provided by wpv-search-term inside the conditional, you may need to write custom code which converts the defaults into something else. If you're satisfied with the default text provided in the conditional by wpv-search-term, you can disregard this.
may i have an example ?
Let's say you wanted to display something other than the search term as it's written in the URL. You could write a custom shortcode called "formatted_search_term" and use it like so:
[wpv-conditional if="( '[wpv-search-term param="wpv-zona"]' )"]
[formatted_search_term term='[wpv-searchterm param="wpv-zona"]']
[/wpv-conditional]
The shortcode PHP would use a similar format to this example:
add_shortcode( 'formatted_search_term', 'formatted_search_term_func');
function formatted_search_term_func($atts)
{
$term = $atts['term'];
// your custom code here that converts $term into the variable $formatted
return $formatted;
}