[[+tv.Category:contains=`[[*Category:replace=`, ==`:or:contains=``]]`:then=` HERE COMES THE CODE THAT DISPLAYS A RELATED PROJECT THUMBNAIL `:else=``]]
[[+tv.Category:contains=`blue`:or:contains=`red`:then=`
This question has been answered by Maciej Krupa. See the first response.
[[!ShowRelated? &tv=`[[+tv.Category]]`]]
/* ShowRelated snippet */
$tv = $modx->getOption('tv', $scriptProperties, '', true);
$category = $modx->resource->get('Category');
$cats = explode(',', $category);
/* collect the categories contained in the TV */
$found = array();
foreach($cats as $cat) {
if (strpos($tv, trim($cat)) !== false) {
$found[] = $cat;
}
}
/* Assuming you want to output a thumbnail for each term found */
foreach($found as $k => $v) {
$output .= $v . ' Code to display project thumbnail';
}
return $output;`:or:contains=`
[[+tv.Category:contains=`[[*Category]]`:then=`
[[!pdoResources? &parents=`ID OF MY PORTFOLIO PROJECTS' CONTAINER` &depth=`0` &limit=`2` &resources=`[[$Related-id-unlimited-list]]` &sortby=`RAND()` &tpl=`TPL FOR THUMBNAILS` &includeTVs=`LIST OF TVs I WILL NEED FOR GENERATING THUMBNAILS` ]]
[[getRelated? &fields=`tv.Category` &parents=`ID OF MY PORTFOLIO PROJECTS' CONTAINER` &limit=`0` &noResults=`` &tplOuter=`outer-tpl` &tplRow=`row-tpl` ]]
[[+wrapper]]
[[+id]],
&resources=`5, 8, 10, 15, `