Page tags shortcode
/**
* {THEME_PAGE_TAGS} - the current page's keywords, each one linked to the matching news list.
*/
function sc_theme_page_tags($parm = array())
{
$page = e107::getScBatch('page', null, 'cpage')->getVars();
if(!is_array($page) || empty($page['page_metakeys']))
{
return '';
}
$tp = e107::getParser();
$class = !empty($parm['class']) ? $parm['class'] : 'page-tag';
$separator = isset($parm['separator']) ? $parm['separator'] : ', ';
$links = array();
foreach(explode(',', $page['page_metakeys']) as $tag)
{
$tag = trim($tag);
if($tag === '')
{
continue;
}
$url = e107::getUrl()->create('news/list/tag', array('tag' => str_replace(' ', '-', $tag)));
$links[] = "<a class='".$class."' href='".$url."'>".$tp->toHTML($tag, false, 'SUMMARY')."</a>";
}
return implode($separator, $links);
}Related: https://github.com/e107inc/e107/issues/3090#issuecomment-5555038520
Last updated