我正试图在一页上获得2个短代码(单包含和单概况)。问题是,只执行第一个短代码。简单页面上的第二个短代码返回短代码字符串。
此代码位于插件中:
add_filter(\'the_content\', \'initQmediaRechnerSnippet\');
function initQmediaRechnerSnippet($content)
{
$pattern = "/\\[([^=]*)=?(.*)?\\]/";
if (preg_match($pattern, $content, $treffer))
{
$snippetName = $treffer[1];
$snippet = \'\';
switch ($snippetName) {
case \'kreditkarte\':
$snippet = qRechnerInclude(API_CALC_KREDITKARTE, \'\');
$content = str_replace(\'[\' . $snippetName . \']\', $snippet, $content);
break;
case \'single-include\':
list($ids, $product) = explode(":", $treffer[2]);
$snippet = qRechnerInclude(str_replace(\'$PRODUCT$\', $product, API_CALC_SINGLEINCLUDE . $ids), \'\');
$content = str_replace(\'[\' . $snippetName . \'=\' . $ids . \':\' . $product . \']\', $snippet, $content);
break;
case \'single-factsheet\':
list($ids, $product) = explode(":", $treffer[2]);
$snippet = qRechnerInclude(str_replace(\'$PRODUCT$\', $product, API_CALC_SINGLEFACTSHEET . $ids), \'\');
$content = str_replace(\'[\' . $snippetName . \'=\' . $ids . \':\' . $product . \']\', $snippet, $content);
break;
default:
;
break;
}
}
return $content;
}
我怎样才能让它工作?(删除中断不起作用)将preg\\u match替换为preg\\u match\\u all会停止所有短代码的执行。