feat(05-03): register 200x200px cropped image size for job logos
Add register_image_sizes() method to DDHH_JM_Post_Types class that registers 'job-logo' image size (200x200px with hard crop). Hook method to after_setup_theme action for proper WordPress timing. This enables Elementor templates to request consistent logo sizing via wp_get_attachment_image() using size 'job-logo'. Auto-generates cropped version when logos uploaded via ACF field. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,9 +18,12 @@ class DDHH_JM_Post_Types {
|
||||
*/
|
||||
public static function register() {
|
||||
self::register_job_offer();
|
||||
|
||||
|
||||
// Hook capability mapping filter
|
||||
add_filter( 'map_meta_cap', array( __CLASS__, 'map_job_offer_capabilities' ), 10, 4 );
|
||||
|
||||
// Hook image size registration
|
||||
add_action( 'after_setup_theme', array( __CLASS__, 'register_image_sizes' ), 10 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,6 +94,14 @@ class DDHH_JM_Post_Types {
|
||||
register_post_type( 'job_offer', $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register custom image sizes for job logos
|
||||
*/
|
||||
public static function register_image_sizes() {
|
||||
// Register 200x200px cropped size for job logos
|
||||
add_image_size( 'job-logo', 200, 200, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Map job_offer capabilities to enforce ownership
|
||||
*
|
||||
@@ -105,7 +116,7 @@ class DDHH_JM_Post_Types {
|
||||
if ( 'edit_job_offer' === $cap || 'delete_job_offer' === $cap ) {
|
||||
// Get the post
|
||||
$post = get_post( $args[0] );
|
||||
|
||||
|
||||
if ( ! $post || 'job_offer' !== $post->post_type ) {
|
||||
return $caps;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user