无法在自定义标题中使用视频

时间:2019-06-05 22:29:32

标签: wordpress custom-headers

在自定义主题下,我无法将视频设置为Header Media。这个主题是从头开始创建的,因此我目前只有以下文件:header.php,footer.php,functions.php,sidebar.php,index.php

我曾尝试在wordpress的主题支持部分将视频设置为true。我尝试复制27主题中的实现。 我在自定义标题主题支持功能中尝试了不同的参数组合。

functions.php:

add_theme_support( 'custom-header', array(
    'video' => true,
) );

header.php:

<?php the_custom_header_markup(); ?>

Wordpress当前给我以下错误:

  

“此主题在此页面上不支持视频标题。导航到   首页或其他支持视频标题的页面。”

1 个答案:

答案 0 :(得分:0)

在我的functions.php中,我正在加载jQuery,如下所示:

    wp_enqueue_script('wptheme-jquery-js-cdn', 'https://code.jquery.com/jquery-3.3.1.slim.min.js');

这导致jQuery首先加载。为了解决这个问题,我强制将其加载到页脚中。

    wp_enqueue_script('wptheme-jquery-js-cdn', 'https://code.jquery.com/jquery-3.3.1.slim.min.js', array(), '', true);

这也是阻止它阻止渲染的更好做法。