在我的产品标题中,我想删除第一个“点”之后的所有文本内容或冒号“:”。
例如,我想转换:Theodore Deck:The Peter Marino Collection=>Theodore Deck
我从中尝试了此代码this article但没有成功。
function explode_parts($title, $id){
$parts = explode(\' : \', $title);
$before = $parts[0]; //before the :
$after = $parts[1]; //after the :
return (whatever);
}
add_filter(\'the_title\', \'explode_parts\');
谢谢你的帮助!