0 || !empty($value)) || is_array($value) && !empty($first_element)) { return $value; } } if (isset($blogup_theme_options[$option])) { return $blogup_theme_options[$option]; } return false; } } /** * Get next page URL * @param int $max_num_pages * @return string/boolean */ if(!function_exists('blogup_next_page_url')) { function blogup_next_page_url($max_num_pages = 0) { if ($max_num_pages === false) { global $wp_query; $max_num_pages = $wp_query->max_num_pages; } if ($max_num_pages > max(1, get_query_var('paged'))) { return get_pagenum_link(max(1, get_query_var('paged')) + 1); } return false; } } /** * Get single post option value * @param unknown $option * @param string $id * @return NULL|mixed */ if(!function_exists('blogup_get_post_opt')) { function blogup_get_post_opt( $option, $id = '' ) { global $post; if (!empty($id)) { $local_id = $id; } else { if(!isset($post->ID)) { return null; } $local_id = get_the_ID(); } if(function_exists('redux_post_meta')) { $options = redux_post_meta(REDUX_OPT_NAME, $local_id); } else { $options = get_post_meta( $local_id, REDUX_OPT_NAME, true ); } //var_dump($local_id); if( isset( $options[$option] ) ) { return $options[$option]; } else { return null; } } } /** * Adding inline styles * @param string $style * @return void * * Usage: * blogup_add_inline_style(".className { color: #FF0000; }") */ if(!function_exists('blogup_add_inline_style')) { function blogup_add_inline_style( $style ) { $oArgs = ThemeArguments::getInstance('inline_style'); $inline_styles = $oArgs -> get('inline_styles'); if (!is_array($inline_styles)) { $inline_styles = array(); } array_push( $inline_styles, $style ); $oArgs -> set('inline_styles', $inline_styles); } } /** * Inline styles * @param type $css * @return type */ if(!function_exists('blogup_css_compress')) { function blogup_css_compress($css) { $css = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css ); $css = str_replace( ': ', ':', $css ); $css = str_replace( array( "\r\n", "\r", "\n", "\t", ' ', ' ', ' ' ), '', $css ); return $css; } } /** * * Blog Excerpt Read More * @since 1.7.0 * @version 1.0.0 * */ if ( ! function_exists( 'blogup_auto_post_excerpt' ) ) { function blogup_auto_post_excerpt( $limit = '', $content = '' ) { $limit = ( empty($limit)) ? 20:$limit; $content = (empty($content)) ? get_the_excerpt():$content; $content = strip_shortcodes( $content ); $content = str_replace( ']]>', ']]>', $content ); $content = strip_tags( $content ); $words = explode( ' ', $content, $limit + 1 ); if( count( $words ) > $limit ) { array_pop( $words ); $content = implode( ' ', $words ); $content .= ' ...'; } return $content; } } /** * * @return none * @param class * multiple class sanitization * **/ if ( ! function_exists( 'blogup_sanitize_html_classes' ) && function_exists( 'sanitize_html_class' ) ) { function blogup_sanitize_html_classes( $class, $fallback = null ) { // Explode it, if it's a string if ( is_string( $class ) ) { $class = explode(" ", $class); } if ( is_array( $class ) && count( $class ) > 0 ) { $class = array_map("sanitize_html_class", $class); return implode(" ", $class); } else { return sanitize_html_class( $class, $fallback ); } } } /** * * element values post, page, categories * @since 1.0.0 * @version 1.0.0 * */ if ( ! function_exists( 'blogup_element_values_page' ) ) { function blogup_element_values_page( $type = '', $query_args = array() ) { $options = array(); switch( $type ) { case 'pages': case 'page': $pages = get_pages( $query_args ); if ( !empty($pages) ) { foreach ( $pages as $page ) { $options[$page->post_title] = $page->ID; } } break; case 'posts': case 'post': $posts = get_posts( $query_args ); if ( !empty($posts) ) { foreach ( $posts as $post ) { $options[$post->post_title] = lcfirst($post->post_title); } } break; case 'tags': case 'tag': $tags = get_terms( $query_args['taxonomies'], $query_args['args'] ); if ( !empty($tags) ) { foreach ( $tags as $tag ) { $options[$tag->term_id] = $tag->name; } } break; case 'categories': case 'category': $categories = get_categories( $query_args ); if ( !empty($categories) ) { foreach ( $categories as $category ) { $options[$category->term_id] = $category->name; } } break; case 'custom': case 'callback': if( is_callable( $query_args['function'] ) ) { $options = call_user_func( $query_args['function'], $query_args['args'] ); } break; } return $options; } } /** * Select blogup footer style * @since blogup 1.0 */ if(!function_exists('blogup_header_template')) { function blogup_header_template($layout) { switch ($layout) { case 'header-style13': default: get_template_part('templates/header/header-style13'); break; } } } /** * Select blogup footer style * @since blogup 1.0 */ if(!function_exists('blogup_footer_template')) { function blogup_footer_template($layout) { switch ($layout) { case 'footer-style3': get_template_part('templates/footer/footer-style3'); break; case 'footer-style2': get_template_part('templates/footer/footer-style2'); break; case 'footer-style1': default: get_template_part('templates/footer/footer-style1'); break; } } } /** * Select blogup slider style * @since blogup 1.0 */ if(!function_exists('blogup_slider_template')) { function blogup_slider_template($layout) { switch ($layout) { case 'slider-style10': default: get_template_part('templates/slider/layouts/slider-style10'); break; } } } /** * Select blogup blog post style * @since blogup 1.0 */ if(!function_exists('blogup_blog_post_template')) { function blogup_blog_post_template($layout) { switch ($layout) { case 'alternative': get_template_part('templates/blog/blog-single/layout/alternative'); break; case 'default': default: get_template_part('templates/blog/blog-single/layout/default'); break; } } } /** * Get associative terms array * * @param type $terms * @return boolean */ if(!function_exists('blogup_get_terms_assoc')) { function blogup_get_terms_assoc($terms) { $terms = get_terms( $terms , array('fields' => 'all' ) ); if (is_array($terms) && !is_wp_error($terms)) { $terms_assoc = array(); foreach ($terms as $term) { $terms_assoc[$term -> term_id] = $term -> name; } return $terms_assoc; } return false; } } /** * Load Google Font * * @param type $terms * @return boolean */ if(!function_exists('blogup_fonts_url')) { function blogup_fonts_url() { $fonts_url = ''; $lora = _x( 'on', 'Lora font: on or off', 'blogup' ); $open_sans = _x( 'on', 'Open Sans font: on or off', 'blogup' ); if ( 'off' !== $lora || 'off' !== $open_sans ) { $font_families = array(); if ( 'off' !== $lora ) { $font_families[] = 'Lora:400,500,700'; } if ( 'off' !== $open_sans ) { $font_families[] = 'Open Sans:400'; } $query_args = array('family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' )); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } } /** * Load Material Icon * * @param type $terms * @return boolean */ if(!function_exists('blogup_material_font_icon')) { function blogup_material_font_icon() { $fonts_url = ''; $material_icons = _x( 'on', 'Material Icons: on or off', 'blogup' ); if ( 'off' !== $material_icons ) { $font_families = array(); if ( 'off' !== $material_icons ) { $font_families[] = 'Material Icons'; } $query_args = array('family' => urlencode( implode( '|', $font_families ) )); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/icon' ); } return esc_url_raw( $fonts_url ); } } /** * Load Google Font * * @param type $terms * @return boolean */ if(!function_exists('blogup_header_height')) { function blogup_header_height($class = '') { $sticky_header = blogup_get_opt('header-enable-sticky-switch'); if(!$sticky_header) { return; } $class = (!empty($class)) ? '-'.$class:''; echo '
'; } } /** * Timestamp Ago * * @param type $terms * @return boolean */ if(!function_exists('blogup_time_ago')) { function blogup_time_ago() { return human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ).' '.__( 'ago', 'blogup' ); } } /** * Post Format * * @param type $terms * @return boolean */ if(!function_exists('blogup_post_format')) { function blogup_post_format($image_size = '', $class = '', $time_farme = true, $url = '') { $post_format = get_post_format(); switch ($post_format) { case 'video': $video_url = (empty($url)) ? blogup_get_post_opt('post-video-url'):$url; $video_length = blogup_get_post_opt('post-video-length'); if(!empty($video_url)): ?> videocam $class)); ?> filter_none $class)); ?> mic $class)); ?> format_quote $class)); ?> 0): ?> $class)); ?>