Php WordPress添加/启用缩略图功能,但不起作用

Php WordPress添加/启用缩略图功能,但不起作用,php,wordpress,thumbnails,custom-wordpress-pages,Php,Wordpress,Thumbnails,Custom Wordpress Pages,我正在创建一个wordpress模板,并在我的主题中添加了缩略图(又称特色图像)支持,就像wordpress codex声明的那样 下面是启用支持的代码: function cleanslate_setup_theme_support() { // Support for post thumbnails a.k.a featured images add_theme_support( 'post-thumbnails' ); } 及 上面的代码起作用了,我看到了“设置特色图

我正在创建一个wordpress模板,并在我的主题中添加了缩略图(又称特色图像)支持,就像wordpress codex声明的那样

下面是启用支持的代码:

function cleanslate_setup_theme_support() {

    // Support for post thumbnails a.k.a featured images
    add_theme_support( 'post-thumbnails' ); 
}

上面的代码起作用了,我看到了“设置特色图像”选项,但在选择我想要设置的图像后,它什么也不做。然后我把我的主题切换到一个默认的主题,看看它是否是我的WP核心,我设置了特色图片,它就工作了。我的主题可能会遇到什么问题?为什么它不设置或删除特色图像/缩略图中的图像

以下是我使用特色图片的方式:

<?php  if ( has_post_thumbnail() ) {  ?><header id="imageBanner" class="major-banner major main-wrap wp-bg-image" style="<?php  $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ); echo 'background-image: url(' . $image['0'] . '); ' . ''  ?>"><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

您在主题的single.php或page.php中使用了吗?@isuruAbey是的,我添加了它,当我将其切换到默认主题以设置图像,然后返回到我的自定义主题页面中显示的特色图像。但是,当我试图设置或删除我的主题时,它将不会删除那里的图像或我选择的图像。@isuruAbey我添加了我使用特色图像的代码。如何显示页面/帖子的内容?你能更新一下吗question@isuruAbey我做了,这应该是问题的最后一段代码
<?php  if ( has_post_thumbnail() ) {  ?><header id="imageBanner" class="major-banner major main-wrap wp-bg-image" style="<?php  $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ); echo 'background-image: url(' . $image['0'] . '); ' . ''  ?>"><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">