';
} else {
$html .= '';
}
if ($echo) {
echo '
' . $html .'
';
} else {
return '' . $html .'
';
}
}
}
// **********************************************************************//
// ! Site preloader
// **********************************************************************//
if ( ! function_exists('etheme_site_preloader') ) {
function etheme_site_preloader(){
if ( !etheme_get_option('site_preloader', 0) ) return;
if ( !apply_filters('etheme_site_preloader', true) ) return;
$img = etheme_get_option( 'preloader_img', '' );
$html = '';
if ( ! empty( $img['url'] ) ){
$html .= '
';
} else {
$html .= '';
}
echo '' . $html .'
';
}
}
add_action( 'et_after_body', 'etheme_site_preloader', 100, 1);
// **********************************************************************//
// ! Pagination links
// **********************************************************************//
if(!function_exists('etheme_pagination')) {
function etheme_pagination($args = array()) {
$is_rtl = is_rtl();
extract( shortcode_atts( array(
'type' => 'default',
'url' => '',
'pages' => 1,
'paged' => 1,
'range' => 2,
'class' => '',
'before' => '',
'after' => '',
'prev_next' => true,
'prev_text' => '',
'next_text' => ''
), $args ) );
if( $pages != 1 ){
etheme_enqueue_style('pagination', true );
$showitems = ( $range * 2 )+1;
$out = '';
if ( $type != 'default' ) {
if ( ! $url ) {
$url = get_permalink();
}
if( $prev_next && $paged > 1 ){
$out .= '' . $prev_text . '';
}
for ( $i=1; $i <= $pages; $i++ ){
if ( $pages != 1 &&( ! ( $i >= $paged+$range+1 || $i <= $paged-$range-1 ) || $pages <= $showitems ) ){
if ( $paged == $i ) {
$out .= '' . $i . '';
} else {
$out .= '' . $i . '';
}
}
}
if ( $prev_next && $paged < $pages ){
$out .= '' . $next_text . '';
}
} else {
if( $prev_next && $paged > 1 ){
$out .= '' . $prev_text . '';
}
for ( $i=1; $i <= $pages; $i++ ){
if ( $pages != 1 &&( ! ( $i >= $paged+$range+1 || $i <= $paged-$range-1 ) || $pages <= $showitems ) ){
if ( $paged == $i ) {
$out .= '' . $i . '';
} else {
$out .= '' . $i . '';
}
}
}
if ( $prev_next && $paged < $pages ){
$out .= '' . $next_text . '';
}
}
echo '
';
}
}
}
// **********************************************************************//
// ! Function to display comments @see comments.php
// **********************************************************************//
if(!function_exists('etheme_comments')) {
function etheme_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited valid usecase
$comment_type = get_comment_type();
if( in_array( $comment_type, array('pingback', 'trackback')) ) : ?>