我需要在我的帖子H1标题之前显示自定义块。
请告诉我。是否有任何函数或挂钩来实现这一点?
我不能单独编辑文件。php,因为我创建了不同的单一模板(single-portfolio.php、single-post.php等)。
我需要在我的帖子H1标题之前显示自定义块。
请告诉我。是否有任何函数或挂钩来实现这一点?
我不能单独编辑文件。php,因为我创建了不同的单一模板(single-portfolio.php、single-post.php等)。
尝试使用类似筛选器的
add_filter(\'the_title\', \'new_title\', 10, 2);
function new_title($title, $id) {
if(\'your-post-type\' == get_post_type($id))
$title = \'Add your DIV block here\';
$title .= $title;
return $title;
}
我正在创建一个插件,其中我创建了一个自定义帖子类型的智能事件,我想通过一个页面为该类别下的单个帖子提供服务。这就是为什么我创建了一个名为:single-event.php 直接进入插件文件夹-类似-event > single-event.php我用这个函数来加载单个页面function myevent($template) { if (\'event\' == get_post_type(get_queried_object_id()) && !$template) {&#