Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress - adding Featured image to custom Post Type

I'm trying to add a Featured Image to my theme but not for Posts or Pages - I've created a custom type called Properties (its for an estate agent), so how do I enable Featured Image, as it doesn't appear in the sceen options?

Hope someone can help,

$property  = new Cuztom_Post_Type( 'Property', array(
    'supports' => array('title', 'editor')
));
like image 713
snakespan Avatar asked Sep 22 '12 12:09

snakespan


People also ask

How do I get featured images in WordPress posts?

Configure WordPress Dashboard SettingsNavigate to your WordPress dashboard and click on Screen Options. Check the Featured image option to display a featured image column in your post and page lists. The Featured image tab should now appear in your content editor.

Is it necessary to add a featured image to every post and page?

If you run any type of site that publishes new content regularly, it's vital to add a featured image to each one. Plus, since these images will do a lot to determine your site's visual style (and even its performance), it pays to spend some time choosing and preparing them carefully.

How do I hide featured images on individual posts in WordPress?

Select a post for which you'd like to hide the featured image. Under the Post tab (to the right) find the Featured Image section. With the plugin now installed, you'll see an option to “Display featured image in post lists only, hide on singular views.” Mark that checkbox to activate the feature.

How do I add featured images or post thumbnails in WordPress?

Adding a Post Thumbnail or Featured Image to WordPress To add a featured image to a WordPress post, simply edit or create a new blog post. The featured image tab is located in the content editor's right column. The WordPress media uploader popup will appear when you click on the 'Set Featured Image' area.


1 Answers

This might help someone,

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' );
like image 168
Muhammad Sadiq Avatar answered Oct 18 '22 13:10

Muhammad Sadiq