• I would like to do is to restrict different thumbnail sizes for especific post types.

    So, as an example:
    * Thumbnails for my custom post type would always be 150×150
    * Thumbnails for my default post type would always be 200×200

    When adding the function for thumbnains in my functions.php file for my theme I can use the following code:

    add_theme_support( 'post-thumbnails', array( 'post', 'partner' ) );
    set_post_thumbnail_size(150,150,true); // 150x150 hard crop mode

    So I can have thumbnails of size 150×150 for my post types post and partner.

    I know I can add multiple thumbnail sizes with a code such as:
    add_image_size(‘TinySize’, 50, 50, true);

    But the point of my suggestion is to be able to configure my WP site so posts of type 1 can have thumbnails of size A, B, C. While posts pof type 2 can have thumbnails of size X, Y, Z.

    What do you guys think?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I have only been working with WordPress for a week so I may not be qualified to answer this however I am not without ideas, I understand any additional functionality must be added to the ini.php file and added consecutively to the specific file and method that calls the image size.

    As I would see this, you would mimic or duplicate the code that uses the default size image, adding a bitmapmatrix filter which you can find rather effective examples online, and add this to your method. This would allow you to reuse the same image on a different scale from the same source. In the instances where you would want to call the “custom” thumbnail you would need to find that section of code and add the condition. I hope this idea helped a little however as I said, Im not very qualified.

    Thread Starter pmdci

    (@pmdci)

    Your comments are welcome. Brainstorming is always good.

    My point here is, however, trying to minimize the amount of file duplication and redundancy.

    If I allow for thumbs of 150×150 and 50×50 for instance, this would be for all post types configured.

    Imagine if I only want 50×50 for one type of post. This post type would nonetheless have both thumbnail sizes.

    I think this could be vlaidated as a possible caveat, particularly for users with space/bandwidth limitations in their servers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Feature: Restrict thumbnail sizes for specific post tpes’ is closed to new replies.