'?paged=%#%',
'current' => $dataArray['current'],
'total' => $dataArray['max_page_num'],
'type' => 'array',
'prev_text' => '',
'next_text' => '',
));
if ( ! empty( $pagination ) ) {
$paginate .= '
';
}
echo wp_kses_post( $paginate );
}
}
// limiting the excerpt
if ( !function_exists('calibar_get_excerpt') ){
function calibar_get_excerpt( $length ){
if ( has_post_format( array( 'aside', 'audio', 'chat', 'link', 'quote', 'status', 'video' ) ) ) {
$excerpt = the_content();
return $excerpt;
} else {
$excerpt = get_the_content();
$excerpt = preg_replace(" ([.*?])",'',$excerpt);
$excerpt = strip_shortcodes($excerpt);
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, $length);
$excerpt = substr($excerpt, 0, strripos($excerpt, " "));
$excerpt = $excerpt.'...';
return $excerpt;
}
}
}
if ( !function_exists( 'calibar_mod_main_query' ) ){
function calibar_mod_main_query( $query ) {
global $calibarOptions;
if ( isset($calibarOptions['tr_blog_order']) && !empty( $calibarOptions['tr_blog_order'] ) ) $posts_order = $calibarOptions['tr_blog_order'];
else $posts_order = 'DESC';
if ( $query->is_home() && $query->is_main_query() ) {
$query->query_vars['order'] = $posts_order;
}
}
add_action( 'pre_get_posts', 'calibar_mod_main_query' );
}
if( !function_exists('calibar_time_ago') ) {
function calibar_time_ago( $type = 'post' ) {
$d = 'comment' == $type ? 'get_comment_time' : 'get_post_time';
echo human_time_diff($d('U'), current_time('timestamp')) . " " . esc_html__('ago','calibar');
}
}
function calibar_get_user_role()
{
global $authordata;
$author_roles = $authordata->roles;
$author_role = array_shift($author_roles);
return $author_role;
}
// Remove issues with prefetching adding extra views
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
if ( !function_exists( 'calibar_search_filter_form' ) ) {
function calibar_search_filter_form( $form ) {
$form = '';
return $form;
}
add_filter( 'get_search_form', 'calibar_search_filter_form' );
}
if( !function_exists('calibar_update_cpt_slug')){
function calibar_update_cpt_slug( $args, $post_type ) {
global $calibarOptions;
if( isset( $calibarOptions['tr_folio_slug'] ) && $calibarOptions['tr_folio_slug'] != '' ):
if ( 'folio' === $post_type ) {
$my_args = array(
'rewrite' => array( 'slug' => $calibarOptions['tr_folio_slug'], 'with_front' => true )
);
return array_merge( $args, $my_args );
}
endif;
return $args;
}
add_filter( 'register_post_type_args', 'calibar_update_cpt_slug', 10, 2 );
}
/**
* @param $width
*
* @since 4.2
* @return bool|string
*/
function calibar_wpb_translateColumnWidthToSpan( $width ) {
preg_match( '/(\d+)\/(\d+)/', $width, $matches );
if ( ! empty( $matches ) ) {
$part_x = (int) $matches[1];
$part_y = (int) $matches[2];
if ( $part_x > 0 && $part_y > 0 ) {
$value = ceil( $part_x / $part_y * 12 );
if ( $value > 0 && $value <= 12 ) {
$width = 'vc_col-lg-' . $value;
}
}
}
return $width;
}
if ( !function_exists( 'calibar_author_info' ) ) {
function calibar_author_info() {
$authorInfo = $google_profile = $facebook_profile = $twitter_profile = $authorDesc = $userid = '';
$userid = get_the_author_meta('ID');
$authorDesc = get_the_author_meta('description', $userid );
$google_profile = get_the_author_meta( 'google_profile', $userid );
$facebook_profile = get_the_author_meta( 'facebook_profile', $userid );
$twitter_profile = get_the_author_meta( 'twitter_profile', $userid );
$authorInfo .= '';
$authorInfo .= '
';
$authorInfo .= get_avatar( get_the_author_meta('email'), '100' );
$authorInfo .= '
';
$authorInfo .= '
'. get_the_author_link() .'';
$authorInfo .= '
'. esc_html( calibar_get_user_role( $userid ) ) .'';
$authorInfo .= '
'. $authorDesc .'
';
if ( ( isset( $google_profile ) && $google_profile != '' ) || ( isset( $twitter_profile ) && $twitter_profile != '' ) || ( isset( $facebook_profile ) && $facebook_profile != '' ) ) :
$authorInfo .= '
';
$authorInfo .= '
';
if ( isset( $google_profile ) && $google_profile != '' ) {
$authorInfo .= ' ';
}
if ( isset( $twitter_profile ) && $twitter_profile != '' ) {
$authorInfo .= ' ';
}
if ( isset( $facebook_profile ) && $facebook_profile != '' ) {
$authorInfo .= ' ';
}
$authorInfo .= '
';
$authorInfo .= '
';
endif;
$authorInfo .= '';
$authorInfo .= '
';
if ( ( isset( $google_profile ) && $google_profile != '' ) || ( isset( $twitter_profile ) && $twitter_profile != '' ) || ( isset( $facebook_profile ) && $facebook_profile != '' ) || !empty( $authorDesc ) ) :
echo wp_kses_post( $authorInfo );
else:
return null;
endif;
}
}
/**
* Check if the site has a custom logo.
*
* @since 1.0.0
*
* @uses has_custom_logo
*
* @return bool Returns true when a Primer logo is set.
*/
function calibar_has_custom_logo() {
/**
* For backwards compatibility prior to WordPress 4.5.
*
* @link https://developer.wordpress.org/reference/functions/has_custom_logo/
* @since 1.0.0
*/
$enabled = function_exists( 'has_custom_logo' ) ? has_custom_logo() : (bool) get_theme_mod( 'custom_logo' );
/**
* Filter if the site has a custom logo.
*
* @since 1.0.0
*
* @var bool
*/
return (bool) apply_filters( 'calibar_has_custom_logo', $enabled );
}