hook_section();
}
/**
* Hook section in.
*/
private function hook_section() {
$section_priority = apply_filters( 'hestia_section_priority', 65, 'hestia_contact' );
add_action( 'hestia_sections', array( $this, 'do_section' ), absint( $section_priority ) );
add_action( 'hestia_do_contact_section', array( $this, 'render_section' ) );
add_action( 'after_setup_theme', array( $this, 'contact_form_legacy' ) );
}
/**
* This function executes once because we removed the default for contact form shortcode and
* it breaks form for users that didn't change that default.
*
* TODO: Remove this in the next version after the release on wp.org
*/
public function contact_form_legacy() {
$execute = get_option( 'hestia_contact_form_legacy' );
if ( $execute !== false ) {
return;
}
$contact_shorcode_with_default = get_theme_mod( 'hestia_contact_form_shortcode', '[pirate_forms]' );
$contact_shorcode_without_default = get_theme_mod( 'hestia_contact_form_shortcode' );
if ( $contact_shorcode_with_default === '[pirate_forms]' && empty( $contact_shorcode_without_default ) ) {
set_theme_mod( 'hestia_contact_form_shortcode', '[pirate_forms]' );
}
update_option( 'hestia_contact_form_legacy', true );
}
/**
* Executes the hook on which the content is rendered.
*/
public function do_section() {
do_action( 'hestia_do_contact_section', false );
}
/**
* Contact section content.
* This function can be called from a shortcode too.
* When it's called as shortcode, the title and the subtitle shouldn't appear and it should be visible all the time,
* it shouldn't matter if is disable on front page.
*
* @since Hestia 1.0
* @modified 1.1.51
*/
function render_section( $is_shortcode = false ) {
/**
* Don't show section if Disable section is checked.
* Show it if it's called as a shortcode.
*/
$hide_section = get_theme_mod( 'hestia_contact_hide', false );
$section_style = '';
if ( $is_shortcode === false && (bool) $hide_section === true ) {
if ( is_customize_preview() ) {
$section_style .= 'display: none;';
} else {
return;
}
}
/**
* Gather data to display the section.
*/
if ( current_user_can( 'edit_theme_options' ) ) {
/* translators: 1 - link to customizer setting. 2 - 'customizer' */
$hestia_contact_subtitle = get_theme_mod( 'hestia_contact_subtitle', sprintf( __( 'Change this subtitle in %s.', 'hestia' ), sprintf( '%2$s', esc_url( admin_url( 'customize.php?autofocus[control]=hestia_contact_subtitle' ) ), __( 'customizer', 'hestia' ) ) ) );
} else {
$hestia_contact_subtitle = get_theme_mod( 'hestia_contact_subtitle' );
}
$hestia_contact_title = get_theme_mod( 'hestia_contact_title', esc_html__( 'Get in Touch', 'hestia' ) );
$hestia_contact_area_title = get_theme_mod( 'hestia_contact_area_title', esc_html__( 'Contact Us', 'hestia' ) );
$hestia_contact_background = get_theme_mod( 'hestia_contact_background', apply_filters( 'hestia_contact_background_default', get_template_directory_uri() . '/assets/img/contact.jpg' ) );
if ( ! empty( $hestia_contact_background ) ) {
$section_style .= 'background-image: url(' . esc_url( $hestia_contact_background ) . ');';
}
$section_style = 'style="' . $section_style . '"';
/**
* In case this function is called as shortcode, we remove the container and we add 'is-shortcode' class.
*/
$class_to_add = $is_shortcode === true ? 'is-shortcode' : '';
$class_to_add .= ! empty( $hestia_contact_background ) ? 'section-image' : '';
hestia_before_contact_section_trigger(); ?>
Bld Mihail Kogalniceanu, nr. 8,7652 Bucharest, Romania
Michael Jordan
+40 762 321 762
Mon - Fri, 8:00-22:00