normalize_layout( (string) get_post_meta( $post->ID, '_aha_hero_slide_layout', true ) );
$kicker = get_post_meta( $post->ID, '_aha_hero_kicker', true );
$headline = get_post_meta( $post->ID, '_aha_hero_headline', true );
$subtitle = get_post_meta( $post->ID, '_aha_hero_subtitle', true );
$button_text = get_post_meta( $post->ID, '_aha_hero_button_text', true );
$link_url = get_post_meta( $post->ID, '_aha_hero_link_url', true );
$link_new_tab = get_post_meta( $post->ID, '_aha_hero_link_new_tab', true ) === '1';
$button2_text = get_post_meta( $post->ID, '_aha_hero_button2_text', true );
$link2_url = get_post_meta( $post->ID, '_aha_hero_link2_url', true );
$link2_new_tab = get_post_meta( $post->ID, '_aha_hero_link2_new_tab', true ) === '1';
$desktop_id = (int) get_post_meta( $post->ID, '_aha_hero_image_desktop_id', true );
$mobile_id = (int) get_post_meta( $post->ID, '_aha_hero_image_mobile_id', true );
$bg_size = (string) get_post_meta( $post->ID, '_aha_hero_bg_size', true );
$bg_position = (string) get_post_meta( $post->ID, '_aha_hero_bg_position', true );
$mbg_size = (string) get_post_meta( $post->ID, '_aha_hero_mobile_bg_size', true );
$mbg_position = (string) get_post_meta( $post->ID, '_aha_hero_mobile_bg_position', true );
$badge_color = get_post_meta( $post->ID, '_aha_hero_badge_color', true );
$badge_size = get_post_meta( $post->ID, '_aha_hero_badge_size', true );
$headline_color = get_post_meta( $post->ID, '_aha_hero_headline_color', true );
$headline_size = get_post_meta( $post->ID, '_aha_hero_headline_size', true );
$subtitle_color = get_post_meta( $post->ID, '_aha_hero_subtitle_color', true );
$subtitle_size = get_post_meta( $post->ID, '_aha_hero_subtitle_size', true );
$btn1_bg = get_post_meta( $post->ID, '_aha_hero_btn1_bg', true );
$btn1_color = get_post_meta( $post->ID, '_aha_hero_btn1_color', true );
$btn1_border = get_post_meta( $post->ID, '_aha_hero_btn1_border_color', true );
$btn1_radius = get_post_meta( $post->ID, '_aha_hero_btn1_radius', true );
$btn2_bg = get_post_meta( $post->ID, '_aha_hero_btn2_bg', true );
$btn2_color = get_post_meta( $post->ID, '_aha_hero_btn2_color', true );
$btn2_border = get_post_meta( $post->ID, '_aha_hero_btn2_border_color', true );
$btn2_radius = get_post_meta( $post->ID, '_aha_hero_btn2_radius', true );
$btn1_bg_mobile = get_post_meta( $post->ID, '_aha_hero_btn1_bg_mobile', true );
$btn1_color_mobile = get_post_meta( $post->ID, '_aha_hero_btn1_color_mobile', true );
$btn1_border_mobile = get_post_meta( $post->ID, '_aha_hero_btn1_border_color_mobile', true );
$btn1_radius_mobile = get_post_meta( $post->ID, '_aha_hero_btn1_radius_mobile', true );
$btn2_bg_mobile = get_post_meta( $post->ID, '_aha_hero_btn2_bg_mobile', true );
$btn2_color_mobile = get_post_meta( $post->ID, '_aha_hero_btn2_color_mobile', true );
$btn2_border_mobile = get_post_meta( $post->ID, '_aha_hero_btn2_border_color_mobile', true );
$btn2_radius_mobile = get_post_meta( $post->ID, '_aha_hero_btn2_radius_mobile', true );
$hide_badge_mobile = get_post_meta( $post->ID, '_aha_hero_hide_badge_mobile', true ) === '1';
$hide_headline_mobile = get_post_meta( $post->ID, '_aha_hero_hide_headline_mobile', true ) === '1';
$hide_subtitle_mobile = get_post_meta( $post->ID, '_aha_hero_hide_subtitle_mobile', true ) === '1';
$hide_btn1_mobile = get_post_meta( $post->ID, '_aha_hero_hide_btn1_mobile', true ) === '1';
$hide_btn2_mobile = get_post_meta( $post->ID, '_aha_hero_hide_btn2_mobile', true ) === '1';
$mobile_card_bg = get_post_meta( $post->ID, '_aha_hero_mobile_card_bg', true );
$custom_css_id = get_post_meta( $post->ID, '_aha_hero_custom_css_id', true );
$custom_css_classes = get_post_meta( $post->ID, '_aha_hero_custom_css_classes', true );
$desktop_url = $desktop_id ? wp_get_attachment_image_url( $desktop_id, 'medium' ) : '';
$mobile_url = $mobile_id ? wp_get_attachment_image_url( $mobile_id, 'medium' ) : '';
$visible_meta_sections = aha_hero_slider_get_layout_meta_section_ids( $slide_layout );
$mobile_hint_current = aha_hero_slider_get_layout_meta_mobile_hint( $slide_layout );
?>
normalize_layout( $layout_raw );
update_post_meta( $post_id, '_aha_hero_slide_layout', $layout );
$kicker = isset( $_POST['aha_hero_kicker'] ) ? wp_kses( wp_unslash( $_POST['aha_hero_kicker'] ), aha_hero_slider_kses_slide_inline() ) : '';
$headline = isset( $_POST['aha_hero_headline'] ) ? wp_kses( wp_unslash( $_POST['aha_hero_headline'] ), aha_hero_slider_kses_slide_inline() ) : '';
$subtitle = isset( $_POST['aha_hero_subtitle'] ) ? wp_kses( wp_unslash( $_POST['aha_hero_subtitle'] ), aha_hero_slider_kses_slide_inline() ) : '';
$button_text = isset( $_POST['aha_hero_button_text'] ) ? sanitize_text_field( wp_unslash( $_POST['aha_hero_button_text'] ) ) : '';
$link_url = self::LAYOUT_IMAGE_ONLY === $layout
? ( isset( $_POST['aha_hero_link_url_image_only'] ) ? aha_hero_slider_sanitize_button_url( sanitize_text_field( wp_unslash( $_POST['aha_hero_link_url_image_only'] ) ) ) : '' )
: ( isset( $_POST['aha_hero_link_url'] ) ? aha_hero_slider_sanitize_button_url( sanitize_text_field( wp_unslash( $_POST['aha_hero_link_url'] ) ) ) : '' );
$button2_text = isset( $_POST['aha_hero_button2_text'] ) ? sanitize_text_field( wp_unslash( $_POST['aha_hero_button2_text'] ) ) : '';
$link2_url = isset( $_POST['aha_hero_link2_url'] ) ? aha_hero_slider_sanitize_button_url( sanitize_text_field( wp_unslash( $_POST['aha_hero_link2_url'] ) ) ) : '';
$desktop_id = isset( $_POST['aha_hero_image_desktop_id'] ) ? absint( wp_unslash( $_POST['aha_hero_image_desktop_id'] ) ) : 0;
$mobile_id = isset( $_POST['aha_hero_image_mobile_id'] ) ? absint( wp_unslash( $_POST['aha_hero_image_mobile_id'] ) ) : 0;
$bg_size = isset( $_POST['aha_hero_bg_size'] ) ? aha_hero_slider_sanitize_bg_size( sanitize_text_field( wp_unslash( $_POST['aha_hero_bg_size'] ) ) ) : '';
$bg_position = isset( $_POST['aha_hero_bg_position'] ) ? aha_hero_slider_sanitize_bg_position( sanitize_text_field( wp_unslash( $_POST['aha_hero_bg_position'] ) ) ) : '';
$mbg_size = isset( $_POST['aha_hero_mobile_bg_size'] ) ? aha_hero_slider_sanitize_bg_size( sanitize_text_field( wp_unslash( $_POST['aha_hero_mobile_bg_size'] ) ) ) : '';
$mbg_position = isset( $_POST['aha_hero_mobile_bg_position'] ) ? aha_hero_slider_sanitize_bg_position( sanitize_text_field( wp_unslash( $_POST['aha_hero_mobile_bg_position'] ) ) ) : '';
update_post_meta( $post_id, '_aha_hero_kicker', $kicker );
update_post_meta( $post_id, '_aha_hero_headline', $headline );
update_post_meta( $post_id, '_aha_hero_subtitle', $subtitle );
update_post_meta( $post_id, '_aha_hero_button_text', $button_text );
update_post_meta( $post_id, '_aha_hero_link_url', $link_url );
$link_new_tab = self::LAYOUT_IMAGE_ONLY === $layout
? ! empty( $_POST['aha_hero_link_new_tab_image_only'] )
: ! empty( $_POST['aha_hero_link_new_tab'] );
update_post_meta( $post_id, '_aha_hero_link_new_tab', $link_new_tab ? '1' : '0' );
update_post_meta( $post_id, '_aha_hero_button2_text', $button2_text );
update_post_meta( $post_id, '_aha_hero_link2_url', $link2_url );
update_post_meta( $post_id, '_aha_hero_link2_new_tab', isset( $_POST['aha_hero_link2_new_tab'] ) ? '1' : '0' );
update_post_meta( $post_id, '_aha_hero_image_desktop_id', $desktop_id );
update_post_meta( $post_id, '_aha_hero_image_mobile_id', $mobile_id );
update_post_meta( $post_id, '_aha_hero_bg_size', $bg_size );
update_post_meta( $post_id, '_aha_hero_bg_position', $bg_position );
update_post_meta( $post_id, '_aha_hero_mobile_bg_size', $mbg_size );
update_post_meta( $post_id, '_aha_hero_mobile_bg_position', $mbg_position );
update_post_meta( $post_id, '_aha_hero_badge_color', sanitize_hex_color( isset( $_POST['aha_hero_badge_color'] ) ? wp_unslash( $_POST['aha_hero_badge_color'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_badge_size', absint( isset( $_POST['aha_hero_badge_size'] ) ? wp_unslash( $_POST['aha_hero_badge_size'] ) : 0 ) ?: '' );
update_post_meta( $post_id, '_aha_hero_headline_color', sanitize_hex_color( isset( $_POST['aha_hero_headline_color'] ) ? wp_unslash( $_POST['aha_hero_headline_color'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_headline_size', absint( isset( $_POST['aha_hero_headline_size'] ) ? wp_unslash( $_POST['aha_hero_headline_size'] ) : 0 ) ?: '' );
update_post_meta( $post_id, '_aha_hero_subtitle_color', sanitize_hex_color( isset( $_POST['aha_hero_subtitle_color'] ) ? wp_unslash( $_POST['aha_hero_subtitle_color'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_subtitle_size', absint( isset( $_POST['aha_hero_subtitle_size'] ) ? wp_unslash( $_POST['aha_hero_subtitle_size'] ) : 0 ) ?: '' );
update_post_meta( $post_id, '_aha_hero_btn1_bg', sanitize_hex_color( isset( $_POST['aha_hero_btn1_bg'] ) ? wp_unslash( $_POST['aha_hero_btn1_bg'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn1_color', sanitize_hex_color( isset( $_POST['aha_hero_btn1_color'] ) ? wp_unslash( $_POST['aha_hero_btn1_color'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn1_border_color', sanitize_hex_color( isset( $_POST['aha_hero_btn1_border_color'] ) ? wp_unslash( $_POST['aha_hero_btn1_border_color'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn1_radius', absint( isset( $_POST['aha_hero_btn1_radius'] ) ? wp_unslash( $_POST['aha_hero_btn1_radius'] ) : 0 ) ?: '' );
update_post_meta( $post_id, '_aha_hero_btn2_bg', sanitize_hex_color( isset( $_POST['aha_hero_btn2_bg'] ) ? wp_unslash( $_POST['aha_hero_btn2_bg'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn2_color', sanitize_hex_color( isset( $_POST['aha_hero_btn2_color'] ) ? wp_unslash( $_POST['aha_hero_btn2_color'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn2_border_color', sanitize_hex_color( isset( $_POST['aha_hero_btn2_border_color'] ) ? wp_unslash( $_POST['aha_hero_btn2_border_color'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn2_radius', absint( isset( $_POST['aha_hero_btn2_radius'] ) ? wp_unslash( $_POST['aha_hero_btn2_radius'] ) : 0 ) ?: '' );
update_post_meta( $post_id, '_aha_hero_btn1_bg_mobile', sanitize_hex_color( isset( $_POST['aha_hero_btn1_bg_mobile'] ) ? wp_unslash( $_POST['aha_hero_btn1_bg_mobile'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn1_color_mobile', sanitize_hex_color( isset( $_POST['aha_hero_btn1_color_mobile'] ) ? wp_unslash( $_POST['aha_hero_btn1_color_mobile'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn1_border_color_mobile', sanitize_hex_color( isset( $_POST['aha_hero_btn1_border_color_mobile'] ) ? wp_unslash( $_POST['aha_hero_btn1_border_color_mobile'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn1_radius_mobile', absint( isset( $_POST['aha_hero_btn1_radius_mobile'] ) ? wp_unslash( $_POST['aha_hero_btn1_radius_mobile'] ) : 0 ) ?: '' );
update_post_meta( $post_id, '_aha_hero_btn2_bg_mobile', sanitize_hex_color( isset( $_POST['aha_hero_btn2_bg_mobile'] ) ? wp_unslash( $_POST['aha_hero_btn2_bg_mobile'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn2_color_mobile', sanitize_hex_color( isset( $_POST['aha_hero_btn2_color_mobile'] ) ? wp_unslash( $_POST['aha_hero_btn2_color_mobile'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn2_border_color_mobile', sanitize_hex_color( isset( $_POST['aha_hero_btn2_border_color_mobile'] ) ? wp_unslash( $_POST['aha_hero_btn2_border_color_mobile'] ) : '' ) ?? '' );
update_post_meta( $post_id, '_aha_hero_btn2_radius_mobile', absint( isset( $_POST['aha_hero_btn2_radius_mobile'] ) ? wp_unslash( $_POST['aha_hero_btn2_radius_mobile'] ) : 0 ) ?: '' );
$mobile_hide_flags = array(
'_aha_hero_hide_badge_mobile' => 'aha_hero_hide_badge_mobile',
'_aha_hero_hide_headline_mobile' => 'aha_hero_hide_headline_mobile',
'_aha_hero_hide_subtitle_mobile' => 'aha_hero_hide_subtitle_mobile',
'_aha_hero_hide_btn1_mobile' => 'aha_hero_hide_btn1_mobile',
'_aha_hero_hide_btn2_mobile' => 'aha_hero_hide_btn2_mobile',
);
foreach ( $mobile_hide_flags as $meta_key => $post_field ) {
if ( ! empty( $_POST[ $post_field ] ) ) {
update_post_meta( $post_id, $meta_key, '1' );
} else {
delete_post_meta( $post_id, $meta_key );
}
}
update_post_meta( $post_id, '_aha_hero_mobile_card_bg', sanitize_hex_color( isset( $_POST['aha_hero_mobile_card_bg'] ) ? wp_unslash( $_POST['aha_hero_mobile_card_bg'] ) : '' ) ?? '' );
$custom_css_id = isset( $_POST['aha_hero_custom_css_id'] ) ? sanitize_title( wp_unslash( $_POST['aha_hero_custom_css_id'] ) ) : '';
update_post_meta( $post_id, '_aha_hero_custom_css_id', $custom_css_id );
$custom_css_classes = isset( $_POST['aha_hero_custom_css_classes'] ) ? sanitize_text_field( wp_unslash( $_POST['aha_hero_custom_css_classes'] ) ) : '';
$custom_css_classes = preg_replace( '/[^a-zA-Z0-9\s_-]/', '', $custom_css_classes );
update_post_meta( $post_id, '_aha_hero_custom_css_classes', $custom_css_classes );
if ( self::LAYOUT_IMAGE_ONLY === $layout ) {
update_post_meta( $post_id, '_aha_hero_link_whole_banner', 'yes' );
} else {
update_post_meta( $post_id, '_aha_hero_link_whole_banner', '' );
}
/**
* Save additional meta data for add-on slide layouts.
*
* Add-ons hook here to save their own fields.
* Nonce and capability checks have already been performed.
*
* @since 1.0.0
*
* @param int $post_id Post ID.
* @param string $layout Current layout slug.
*/
do_action( 'aha_hero_slider_save_slide_meta', $post_id, $layout );
}
}