Php 功能未显示在子主题WordPress中

Php 功能未显示在子主题WordPress中,php,wordpress,jetpack,Php,Wordpress,Jetpack,我对WordPress中Aaron child主题的函数有问题。我的问题有一部分得到了解答,但我无法使徽标的尺寸更大。为了缩小范围并发现问题,我删除了很多代码。我发现WordPress中没有出现子主题中的函数。这就是功能: /* Site Logo */ function add_site_icon_support() { $args = array( 'header-text' => array( 'Site Title Here', 'Your si

我对WordPress中Aaron child主题的函数有问题。我的问题有一部分得到了解答,但我无法使徽标的尺寸更大。为了缩小范围并发现问题,我删除了很多代码。我发现WordPress中没有出现子主题中的函数。这就是功能:

/* Site Logo */
function add_site_icon_support() {
  $args = array(
    'header-text' => array(
      'Site Title Here',
      'Your site description goes here.',
    ),
    'size' => 'medium',
  );
  add_theme_support( 'site-logo', $args );
}
add_action( 'after_setup_theme', 'add_site_icon_support' );
我通过将它添加到父主题中的functions.php中进行了测试,结果证明它是有效的。因此,我想知道如何让它在儿童主题中工作

它是否与父主题中的此函数有关

function aaron_setup() {
  /*
   * Make theme available for translation.
   * Translations can be filed in the /languages/ directory.
   * If you're building a theme based on aaron, use a find and replace
   * to change 'aaron' to the name of your theme in all the template files
   */
  load_theme_textdomain('aaron', get_template_directory() . '/languages');
  // Add default posts and comments RSS feed links to head.
  add_theme_support('automatic-feed-links');
  add_theme_support('woocommerce');
  add_theme_support('jetpack-responsive-videos');
  add_editor_style();
  add_theme_support('post-thumbnails');
  add_image_size('aaron-featured-posts-thumb', 360, 300);
  add_theme_support('title-tag');
  register_nav_menus(array(
    'header' => __('Primary Menu', 'aaron'),
    'social' => __('Social Menu', 'aaron'),
  ));
  /*
   * Switch default core markup for search form, comment form, and comments
   * to output valid HTML5.
  */
  add_theme_support('html5', array('search-form', 'comment-form', 'comment-list', 'gallery', 'caption'));
}
endif; // aaron_setup
add_action('after_setup_theme', 'aaron_setup');

因为两者都有相同的钩子。

您需要在父主题之后运行钩子。您需要记住,首先加载子主题,然后加载父主题

要使函数正常工作,您需要一个较低的优先级,即较高的数字。你可以试试

add_action( 'after_setup_theme', 'add_site_icon_support', 11 );

在设置主题之后,尝试在
中设置较低的优先级。如果父主题中存在适当的函数,而子主题中不存在,则该函数应自动工作。很可能您的子主题中有一个不同的函数正在重写父函数,它根本不应该存在。@dda,谢谢您编辑此消息。谢谢!它起作用了。我一直在互联网上寻找,只是找不到正确的答案…我确实读了一些关于儿童主题加载的文章,但没有关于优先级的内容…只是10是一个默认数字或类似的东西。。。