Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #22080, comment 25


Ignore:
Timestamp:
04/18/2016 12:52:53 PM (8 years ago)
Author:
jmichaelward
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22080, comment 25

    initial v1  
    55As an example, I was reviewing the current version of WooCommerce (version 2.4.7 at the time of this writing) when I noticed that line 348 of woocommerce.php declares a function titled add_thumbnail_support(). This function runs a check to see whether the currently-installed theme supports post thumbnails. If it doesn't, the plugin adds post thumbnail theme support for all installed post types, then attaches that theme support the WooCommerce product post type, as well.
    66
    7 This could be potentially confusing to an end user who did not have post thumbnail support previously activated in their theme, and upon activated WooCommerce, now sees the option to add featured images to all of their pages, posts, and any other custom post type that is registered in the system. Furthermore, should they choose to add a featured image to those previously-unsupported post types, confusion may be compounded when they do not see those images displayed on the front-end.
     7This could be potentially confusing to an end user who did not have post thumbnail support previously activated in their theme, and upon activating WooCommerce, now sees the option to add featured images to all of their pages, posts, and any other custom post type that is registered in the system. Furthermore, should they choose to add a featured image to those previously-unsupported post types, confusion may be compounded when they do not see those images displayed on the front-end.
    88
    9 Currently, add_theme_support( 'post-thumbnail' ) accepts an additional array value for which post types should include post thumbnail support. Ideally, plugin authors would be able to do something along these lines:
     9Currently, `add_theme_support( 'post-thumbnails' )` accepts an additional array value for which post types should include post thumbnail support. Ideally, plugin authors would be able to do something along these lines:
    1010
    11 add_theme_support( 'post-thumbnails', array( 'my_custom_post_type' );
     11`add_theme_support( 'post-thumbnails', array( 'my_custom_post_type' ) );`
    1212
    1313...which would append their custom post type to an array of other post types that have post thumbnail support enabled. If none are enabled, this would register post thumbnail support and assign it to that post type. If, at that time, the end user installs another plugin or a theme that adds specified post thumbnail support in this manner, there would be no conflicts as to which post types would be displaying the option to attach a featured image.
    1414
    15 I just came across this issue today, so I don't have a proposed resolution just yet, but I do think we can improve upon the previously solutions that have been proposed. I'll plan to write something up and submit it in the next few days. In the meantime, I wanted to re-open this issue for discussion.
     15I just came across this issue today, so I don't have a proposed resolution just yet, but I do think we can improve upon the previous solutions that have been proposed. I'll plan to write something up and submit it in the next few days. In the meantime, I wanted to re-open this issue for discussion.
    1616
    1717