WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Issue with custom post types, WordPress 3 and Twenty Ten theme

[Resolved] Issue with custom post types, WordPress 3 and Twenty Ten theme

  • I’m using WordPress 3 rc 1 on a local install with the default theme (Twenty Ten).

    I have started tinkering with custom post types and have tried including support for thumbnails.

    This works OK but if I look at a published custom post type page the thumbnail is there but the image also appears as a custom header at the same time.

    The thing is, if I try adding thumbnails to a regular post type the thumbnail appears but the header stays as it should.

    Is it possible to allow thumbnail support with altering the header image for custom post types?

Viewing 1 replies (of 1 total)
  • OK I seem to have found the solution.

    At line 74 in the Twenty Ten header.php there is the following line of code:

    $image[1] >= HEADER_IMAGE_WIDTH ) :
    // Houston, we have a new header image!

    And in functions.php there is the following:

    // The height and width of your custom header. You can hook into the theme's own filters to change these values.
    	// Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
    	define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
    	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) );
    
    	// We'll be using post thumbnails for custom header images on posts and pages.
    	// We want them to be 940 pixels wide by 198 pixels tall.
    	// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
    	set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );

    Twenty Ten tests to see if your image is larger than or equal to the default width of 940px – if it is it becomes the custom header image. These values can be customised with filters.

    Perry

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Issue with custom post types, WordPress 3 and Twenty Ten theme’ is closed to new replies.