操作名称表明它已运行_after_the_content
, 不在the_content
所以你可能需要做一些不同的事情,比如@SamuelElh建议。。。
您可以将一个函数添加到具有早期优先级的操作缓冲区中,然后将一个过滤器添加到具有晚期优先级的最终输出中:
add_action(\'tribe_events_single_event_after_the_content\',\'tribe_events_single_event_buffer_start\',0);
function tribe_events_single_event_buffer_start() {ob_start();}
add_action(\'tribe_events_single_event_after_the_content\',\'tribe_events_single_event_buffer_end\',999);
function tribe_events_single_event_buffer_end() {
return apply_filters(\'tribe_events_single_event_filter_output\',ob_get_clean());
}
function tribe_events_single_event_filter_output($content) {
$content = preg_replace("/tribe-events-button/i", "tribe-events-button button", $content);
return $content;
}