Php 主题不从子主题获取post格式文件

Php 主题不从子主题获取post格式文件,php,wordpress,Php,Wordpress,我有一个主题为“post-format”.php的文件。(模板/blog/)。我想更改此文件中的某些内容,以便需要在子主题中添加此内容 add_action( 'after_setup_theme', 'setup_postformats', 10); //add_action( 'after_setup_theme', 'setup_postformats', 20); //add_action( 'after_setup_theme', 'setup_postformats', 11);

我有一个主题为“post-format”.php的文件。(模板/blog/)。我想更改此文件中的某些内容,以便需要在子主题中添加此内容

add_action( 'after_setup_theme', 'setup_postformats', 10);
//add_action( 'after_setup_theme', 'setup_postformats', 20);
//add_action( 'after_setup_theme', 'setup_postformats', 11);

function setup_postformats(){
    remove_theme_support('post-formats');
  add_theme_support('post-formats',  array( 
     'aside', 
     'chat', 
     'gallery', 
     'image', 
     'link', 
     'quote', 
     'status', 
     'video', 
     'audio'
  ));
}
在子主题中,我创建了文件夹(templates/blog/),然后粘贴文件。根据我的研究,我在child theme function.php中添加了以下代码。函数名为property。但当我运行它时,总是从父主题而不是子主题获取post-format.php文件

add_action( 'after_setup_theme', 'setup_postformats', 10);
//add_action( 'after_setup_theme', 'setup_postformats', 20);
//add_action( 'after_setup_theme', 'setup_postformats', 11);

function setup_postformats(){
    remove_theme_support('post-formats');
  add_theme_support('post-formats',  array( 
     'aside', 
     'chat', 
     'gallery', 
     'image', 
     'link', 
     'quote', 
     'status', 
     'video', 
     'audio'
  ));
}
主题名称-林肯
有人能帮我吗?

重要的是,设置后设置主题的优先级高于父主题。默认优先级为10。使用
twentythetic
作为示例,在子主题上使用优先级11<代码>“设置主题后”操作。请参考以下示例:

function twentysixteen_child_setup() {
    add_theme_support( 'post-formats', array(
        'video',
    ) );
}
add_action( 'after_setup_theme', 'twentysixteen_child_setup', 11 );
更新


我认为您需要添加代码,以便在子主题functions.php文件中包含post-format.php。因此,它将采用子主题版本的post-format.php

希望这能解决你的问题


感谢和问候

事实上我已经试过11次了,但忘了具体说明。它不起作用。我试过——包括'post format.php';或者包括“templates/blog/post format.php”-在这两种情况下,单个贴子页面从父主题获取贴子格式文件。如果我加上这个,即使是子主题中的另一个页面也不能正常工作。主题名-LincolnTheme在最前面,似乎可以很好地使用它。您可以尝试使用插件创建子主题并测试代码。还可以通过从父主题中删除post-format.php文件来尝试您的旧代码。请在执行之前进行备份。我从父主题中删除了post-format.php文件,但它仍然没有从子主题中获取post-format文件。如果我使用这个插件,那么我是否需要先删除我以正常方式创建的子主题?。