' .
sprintf(
wp_kses(
/* translators: %s is Link to login */
__( 'You must be logged in to post a comment.', 'hestia' ),
array(
'a' => array(
'href' => array(),
),
)
),
esc_url( wp_login_url( apply_filters( 'the_permalink', esc_url( get_permalink() ) ) ) )
) . '
',
'comment_field' => '
',
);
return $args;
}
}
if ( ! function_exists( 'hestia_comments_list' ) ) {
/**
* Custom list of comments for the theme.
*
* @since Hestia 1.0
*
* @param string $comment comment.
* @param array $args arguments.
* @param integer $depth depth.
*/
function hestia_comments_list( $comment, $args, $depth ) {
?>
id="comment-">
'
',
'after' => '
',
'link_before' => '
',
'link_after' => '
',
)
);
?>
' . $image[1] . ' × ' . $image[2] . '';
}
}
/* Join the links in a string and return. */
return join( ' | ', $links );
}
}
if ( ! function_exists( 'hestia_sidebar_placeholder' ) ) {
/**
* Display sidebar placeholder.
*
* @param string $class_to_add Classes to add on container.
* @param string $sidebar_id Id of the sidebar used as a class to differentiate hestia-widget-placeholder for blog and shop pages.
* @param string $classes Classes to add to placeholder.
*
* @access public
* @since 1.1.24
*/
function hestia_sidebar_placeholder( $class_to_add, $sidebar_id, $classes = 'col-md-3 blog-sidebar-wrapper' ) {
$content = apply_filters( 'hestia_sidebar_placeholder_content', esc_html__( 'This sidebar is active but empty. In order to use this layout, please add widgets in the sidebar', 'hestia' ) );
?>
';
if ( $is_section_toggle ) {
$icon = '';
}
echo
'';
}
}
if ( ! function_exists( 'hestia_no_content_get_header' ) ) {
/**
* Header for page builder blank template
*
* @since 1.1.24
* @access public
*/
function hestia_no_content_get_header() {
?>
class="no-js">
>
1 ) {
$opacity = 1.0;
}
$output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')';
} else {
$output = 'rgb(' . implode( ',', $rgb ) . ')';
}
return esc_html( $output );
}
}
if ( ! function_exists( 'hestia_hex_rgba' ) ) {
/**
* HEX colors conversion to RGBA.
*
* @param array|string $input RGB color.
* @param int $opacity Opacity value.
*
* @return string
*/
function hestia_hex_rgba( $input, $opacity = 1 ) {
$rgb = hestia_hex_rgb( $input );
return hestia_rgb_to_rgba( $rgb, $opacity );
}
}
if ( ! function_exists( 'hestia_adjust_brightness' ) ) {
/**
* Generate a new color, darker or lighter.
*
* @param string $hex Color in hex.
* @param int $steps Steps should be between -255 and 255. Negative = darker, positive = lighter.
*
* @return string
*/
function hestia_adjust_brightness( $hex, $steps ) {
// Steps should be between -255 and 255. Negative = darker, positive = lighter
$steps = max( - 255, min( 255, $steps ) );
// Normalize into a six character long hex string
$hex = str_replace( '#', '', $hex );
if ( strlen( $hex ) == 3 ) {
$hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
}
// Split into three parts: R, G and B
$color_parts = str_split( $hex, 2 );
$return = '#';
foreach ( $color_parts as $color ) {
$color = hexdec( $color ); // Convert to decimal
$color = max( 0, min( 255, $color + $steps ) ); // Adjust color
$return .= str_pad( dechex( $color ), 2, '0', STR_PAD_LEFT ); // Make two char hex code
}
return $return;
}
}
if ( ! function_exists( 'hestia_add_animationation' ) ) {
/**
* Add animation attribute for animate-on-scroll.
*
* @param string $animation_type the type of animation.
*
* @return string
*/
function hestia_add_animationation( $animation_type ) {
if ( ! defined( 'HESTIA_PRO_FLAG' ) ) {
return '';
}
$enable_animations = apply_filters( 'hestia_enable_animations', true );
$output = '';
if ( $enable_animations && ! empty( $animation_type ) ) {
$output .= ' data-aos="';
$output .= $animation_type;
$output .= '" ';
}
return $output;
}
}
if ( ! function_exists( 'hestia_layout' ) ) {
/**
* Returns class names used for the main page/post content div
* Based on the Boxed Layout and Header Layout customizer options
*
* @since Hestia 1.0
* @modified 1.1.64
*/
function hestia_layout() {
/**
* For the Page Builder Full Width template don't add any extra classes (except main)
*/
if ( is_page_template( 'page-templates/template-pagebuilder-full-width.php' ) ) {
return 'main';
}
$layout_class = 'main ';
$hestia_general_layout = get_theme_mod( 'hestia_general_layout', apply_filters( 'hestia_boxed_layout_default', 1 ) );
/**
* Add main-raised class when the Boxed Layout option is enabled
*/
if ( isset( $hestia_general_layout ) && $hestia_general_layout == 1 ) {
$layout_class .= ' main-raised ';
}
/**
* For WooCommerce pages don't add any extra classes (except main or main-raised)
*/
if ( class_exists( 'WooCommerce' ) && is_product() ) {
return $layout_class;
}
return $layout_class;
}
}
if ( ! function_exists( 'hestia_limit_content' ) ) {
/**
* Function that limits a text to $limit words, words that are separated by $separator
*
* @param array $input Content to limit.
* @param int $limit Max size.
* @param string $separator Separator.
* @param bool $show_more Flag to decide if '...' should be added at the end of result.
*
* @return string
*/
function hestia_limit_content( $input, $limit, $separator = ',', $show_more = true ) {
if ( $limit === 0 ) {
return '';
}
$length = sizeof( $input );
$more = $length > $limit ? apply_filters( 'hestia_text_more', ' ...' ) : '';
$result = '';
$index = 0;
foreach ( $input as $word ) {
if ( $index < $limit || $limit < 0 ) {
$result .= $word;
if ( $length > 1 && $index !== $length - 1 && $index !== $limit - 1 ) {
$result .= $separator;
if ( $separator === ',' ) {
$result .= ' ';
}
}
}
$index ++;
}
if ( $show_more === true ) {
$result .= $more;
}
return $result;
}
}
if ( ! function_exists( 'hestia_edited_with_pagebuilder' ) ) {
/**
* This function returns whether the theme use or not one of the following page builders:
* SiteOrigin, WP Bakery, Elementor, Divi Builder or Beaver Builder.
*
* @since 1.1.63
* @return bool
*/
function hestia_edited_with_pagebuilder( $pid = '' ) {
$frontpage_id = get_option( 'page_on_front' );
if ( ! empty( $pid ) ) {
$frontpage_id = $pid;
}
/**
* Exit with false if there is no page set as frontpage.
*/
if ( intval( $frontpage_id ) === 0 ) {
return false;
}
/**
* Elementor, Beaver Builder, Divi and Siteorigin mark if the page was edited with its editors in post meta
* so we'll have to check if plugins exists and the page was edited with page builder.
*/
$post_meta = ! empty( $frontpage_id ) ? get_post_meta( $frontpage_id ) : '';
$page_builders_values = array(
'elementor' => ! empty( $post_meta['_elementor_edit_mode'] ) && $post_meta['_elementor_edit_mode'][0] === 'builder' && class_exists( 'Elementor\Plugin' ),
'beaver' => ! empty( $post_meta['_fl_builder_enabled'] ) && $post_meta['_fl_builder_enabled'][0] === '1' && class_exists( 'FLBuilder' ),
'siteorigin' => ! empty( $post_meta['panels_data'] ) && class_exists( 'SiteOrigin_Panels' ),
'divi' => ! empty( $post_meta['_et_pb_use_builder'] ) && $post_meta['_et_pb_use_builder'][0] === 'on' && class_exists( 'ET_Builder_Plugin' ),
);
/**
* WP Bakery (former Visual Composer) doesn't store a flag in meta data to say whether or not the page
* is edited with it so we have to check post content if it contains shortcodes from plugin.
*/
$post_content = get_post_field( 'post_content', $frontpage_id );
if ( ! empty( $post_content ) ) {
$page_builders_values['wpbakery'] = class_exists( 'Vc_Manager' ) && strpos( $post_content, '[vc_' ) !== false;
}
/**
* Check if at least one page builder returns true and return true if it does.
*/
foreach ( $page_builders_values as $page_builder ) {
if ( $page_builder === true ) {
return true;
}
}
return false;
}
}
if ( ! function_exists( 'hestia_category' ) ) {
/**
* Displays blog categories
*
* @param boolean $rel_tag should have rel='tag'.
* @since Hestia 1.0
*
* @return string
*/
function hestia_category( $rel_tag = true ) {
$hestia_disable_categories = get_theme_mod( 'hestia_disable_categories', 'one' );
if ( ! $hestia_disable_categories || $hestia_disable_categories === 'none' ) {
return '';
}
$filtered_categories = '';
$categories = get_the_category();
if ( ! empty( $categories ) ) {
foreach ( $categories as $category ) {
/* translators: %s is Category name */
$filtered_categories .= '' . esc_html( $category->name ) . ' ';
if ( $hestia_disable_categories === 'one' ) {
break;
}
}
}
return $filtered_categories;
}
}
if ( ! function_exists( 'hestia_get_excerpt_default' ) ) {
/**
* Get default values excerpt value.
*
* @access public
*/
function hestia_get_excerpt_default() {
if ( is_active_sidebar( 'sidebar-1' ) ) {
return 40;
}
return 75;
}
}
if ( ! function_exists( 'hestia_contact_form_placeholder' ) ) {
/**
* Render the contact form placeholder for the contact section.
*
* @since 1.1.31
* @modified 1.1.86
*/
function hestia_contact_form_placeholder() {
return '
' . esc_html__( 'Contact Us', 'hestia' ) . '
' .
sprintf(
/* translators: %1$s is Plugin name */
esc_html__( 'In order to add a contact form to this section, you need to install the %s plugin.', 'hestia' ),
esc_html( 'WPForms Lite' )
) . '