2

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

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

函数.php:

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

头文件.php:

<?php the_custom_header_markup(); ?>

Wordpress 目前给我以下错误:

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

4

1 回答 1

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);

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

于 2019-06-06T18:27:28.000 回答