Hi David,
I'm currently using the shortcode [pto search="Keywords"] in my WP web site and, if possible, I would like to create multiple templates it to use in different parts of the site.
I.e.
[pto1 search="Keywords"] -> to show titles without images and descriptions
[pto1 search="Keywords"] -> to show images without tiles and descriptions,
etc.
Is that possible with just minor modifications? If so, could you provide some general direction to get it done?
Thank you
Hi,
Sure - what you could do is add support for multiple templates to be defined within the Search Results / Each template, using %name%....%name% delimiters, including a %default%...%default% section for normal search results / related products, for example:
%default%
<!-- existing search results / each template HTML here -->
%default%
%template1%
<!-- alternative HTML for template1 here -->
%template1%
%template2%
<!-- alternative HTML for template2 here -->
%template2%
With that in place, edit pto.php and look for the following code at line 826:
$html .= pto_search();
...and REPLACE with:
global $pto_searchTemplate;
if (isset($atts["template"])) $pto_searchTemplate = $atts["template"];
$html .= pto_search();
And finally edit pto_search.php and look for the following code beginning at line 533:
$html = "";
...and REPLACE with:
global $pto_searchTemplate;
if (!isset($pto_searchTemplate)) $pto_searchTemplate = "default";
$pto_html_search_each = str_replace(array("\n","\r")," ",$pto_html_search_each);
preg_match('/%'.$pto_searchTemplate.'%(.*)%'.$pto_searchTemplate.'%/U',$pto_html_search_each,$matches);
$pto_html_search_each = $matches[1];
$html = "";
And then use shortcodes for example;
[pto search="Keywords" template="template1"]
[pto search="Keywords" template="template2"]
Hope this helps!
Cheers,
David.
--
PriceTapestry.com