Skip to content

Commit 2b5e0bd

Browse files
committed
Fix getting porch type, for non D.T sites
1 parent 0eeb0c8 commit 2b5e0bd

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

campaign-functions/setup-functions.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,17 @@ function dt_campaigns_is_ramadan_campaign( $campaign_id ){
7373
if ( empty( $campaign_id ) ){
7474
return false;
7575
}
76-
$campaign = DT_Posts::get_post( 'campaigns', $campaign_id, true, false );
77-
if ( is_wp_error( $campaign ) ){
78-
return false;
76+
$porch_type = '';
77+
if ( class_exists( 'DT_Posts' ) ){
78+
$campaign = DT_Posts::get_post( 'campaigns', $campaign_id, true, false );
79+
if ( is_wp_error( $campaign ) ){
80+
return false;
81+
}
82+
$porch_type = isset( $campaign['porch_type']['key'] ) && $campaign['porch_type']['key'] === 'ramadan-porch';
83+
} else {
84+
$porch_type = get_post_meta( $campaign_id, 'porch_type', true );
7985
}
80-
return isset( $campaign['porch_type']['key'] ) && $campaign['porch_type']['key'] === 'ramadan-porch';
86+
return empty( $porch_type ) ? false : $porch_type;
8187
}
8288

8389
/**

0 commit comments

Comments
 (0)