hook_section();
}
/**
* Hook section in/
*/
private function hook_section() {
$section_priority = apply_filters( 'hestia_section_priority', 60, 'hestia_blog' );
add_action( 'hestia_sections', array( $this, 'do_section' ), absint( $section_priority ), 2 );
add_action( 'hestia_do_blog_section', array( $this, 'render_section' ) );
}
/**
* Executes the hook on which the content is rendered.
*/
public function do_section() {
do_action( 'hestia_do_blog_section', false );
}
/**
* Blog section content.
*/
public 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_blog_hide', false );
$section_style = '';
if ( $is_shortcode === false && (bool) $hide_section === true ) {
if ( is_customize_preview() ) {
$section_style = '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_blog_subtitle = get_theme_mod( 'hestia_blog_subtitle', sprintf( __( 'Change this subtitle in the %s.', 'hestia' ), sprintf( '%2$s', esc_url( admin_url( 'customize.php?autofocus[control]=hestia_blog_subtitle' ) ), __( 'Customizer', 'hestia' ) ) ) );
} else {
$hestia_blog_subtitle = get_theme_mod( 'hestia_blog_subtitle' );
}
$hestia_blog_title = get_theme_mod( 'hestia_blog_title', __( 'Blog', 'hestia' ) );
if ( $is_shortcode ) {
$hestia_blog_title = '';
$hestia_blog_subtitle = '';
}
/**
* In case this function is called as shortcode, we remove the container and we add 'is-shortcode' class.
*/
$wrapper_class = $is_shortcode === true ? 'is-shortcode' : '';
$container_class = $is_shortcode === true ? '' : 'container';
hestia_before_blog_section_trigger(); ?>
' . hestia_sanitize_string( $hestia_blog_subtitle ) . '
';
}
?>