<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}

class CGC_Hooks {

    public function __construct() {
        add_filter('body_class', array($this, 'add_tailwind_body_class'));

        add_action('admin_body_class', array($this, 'add_tailwind_body_class_to_admin'), 10, 1);


        add_filter( 'intermediate_image_sizes_advanced', array( $this, 'limit_design_subsizes' ), 10, 3 );
    }

    public function limit_design_subsizes($sizes, $metadata, $image) {
        $cgc_design = get_post_meta($image, 'cgc-design-image', true);
        if ( $cgc_design ) {
            $sizes = array('thumbnail' => $sizes['thumbnail']);
        }
        return $sizes;
    }


    public function add_tailwind_body_class_to_admin($classes) {
        $classes .= ' tailwind';
        return $classes;
    }

    public function add_tailwind_body_class($classes) {
        $classes[] = 'tailwind';
        return $classes;
    }
}

new CGC_Hooks();
?>