テーマに注目の画像を追加しようとしていますが、投稿やページには追加していません-プロパティ(不動産業者向け)というカスタムタイプを作成しました。表示されないので、注目の画像を有効にするにはどうすればよいですか。画面オプションで?
誰かが助けてくれることを願っています、
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor')
));
テーマに注目の画像を追加しようとしていますが、投稿やページには追加していません-プロパティ(不動産業者向け)というカスタムタイプを作成しました。表示されないので、注目の画像を有効にするにはどうすればよいですか。画面オプションで?
誰かが助けてくれることを願っています、
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor')
));
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor', 'thumbnail')
));
私は自分の質問を解決したようです-上記を参照してください
これは誰かを助けるかもしれません、
add_theme_support('post-thumbnails');
add_post_type_support( 'my_product', 'thumbnail' );
function create_post_type() {
register_post_type( 'my_product',
array(
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => true,
'has_archive' => true
)
);
}
add_action( 'init', 'create_post_type' );
テーマのfunction.phpファイルの次のコード行を使用して、任意のカスタム投稿タイプのサポート投稿サムネイルを有効にすることができます。
add_post_type_support( 'forum', 'thumbnail' );
注:ここで、forum
は投稿タイプ名です。
このコードをafter_setup_theme
フックに保持できます。
おそらくこれは役立つでしょう
function create_post_type() {
register_post_type( 'sadaf_films',
array(
'labels' => array(
'name' => __( 'Films' ),
'singular_name' => __( 'Film' )
),
'public' => true,
'has_archive' => true,
'supports' => array( 'title', 'editor', 'custom-fields','thumbnail' ),
)
);
}
add_action( 'init', 'create_post_type' );
このコードを100%使用する
add_theme_support('post-thumbnails');
add_post_type_support( 'news', 'thumbnail' );
function create_posttype() {
register_post_type( 'news',
array(
'labels' => array(
'name' => __( 'News' ),
'singular_name' => __( 'news' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'news'),
'menu_icon' => 'dashicons-format-aside',
)
);
}
add_action( 'init', 'create_posttype' );
add_theme_support('post-thumbnails');
add_post_type_support( 'testimonial', 'thumbnail' );
function create_posttype() {
register_post_type( 'testimonial',
array(
'labels' => array(
'name' => __( 'Testimonial' ),
'singular_name' => __( 'testimonial' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'testimonial'),
// add category in custom post type
'taxonomies' => array( 'category'),
)
);
}
add_action( 'init', 'create_posttype' );