特色图片选项未显示在自定义帖子类型中

时间:2015-06-05 04:47:13

标签: wordpress

我创建了一个自定义帖子类型,但是特色图片选项没有显示在右侧。它在帖子和页面上可见,但在自定义帖子类型上不可见。我已经检查了屏幕选项它没有显示在那里我也尝试过functions.php

 add_theme_support( 'post-thumbnails');

请帮助任何替代方式或插件?

3 个答案:

答案 0 :(得分:2)

检查您的自定义帖子类型代码,应该有

'supports' => array( 'title', 'editor', 'comments', 'excerpt', 'custom-fields', 'thumbnail' ),

在其中。

如果你无法查看。

或尝试下面的function.php中的代码

add_theme_support('post-thumbnails');

答案 1 :(得分:0)

在定义帖子类型时添加缩略图支持...

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.log4j.Logger;

public enum MyThreadFactory implements ThreadFactory {
    INSTANCE;

    private final AtomicInteger poolNumber = new AtomicInteger(1);
    private final Logger logger = Logger.getLogger(getClass());
    private final ThreadGroup threadGroup;
    private final AtomicInteger threadNumber = new AtomicInteger(1);
    private final String namePrefix;

    private RpiThreadFactory() {
        SecurityManager securityManager = System.getSecurityManager();
        threadGroup = (securityManager != null) ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup();
        namePrefix = "RpiPool-" + poolNumber.getAndIncrement() + "-Thread-";

    }

    public Thread newThread(Runnable runnable) {
        Thread thread = new Thread(threadGroup, runnable, namePrefix + threadNumber.getAndIncrement(), 0);
        thread.setPriority(Thread.NORM_PRIORITY);
        thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {

            public void uncaughtException(Thread thread, Throwable cause) {
                logger.error(cause.getMessage(), cause);
            }
        });

        logger.debug(thread.toString() + " created.");
        return thread;
    }
}

请参阅以下链接:

https://codex.wordpress.org/Function_Reference/register_post_type

答案 2 :(得分:0)

您需要在当前主题上添加新的自定义帖子类型的名称

add_theme_support('post-thumbnails', array('post', 'page', 'movies','the_name_of_your_new_CPT')