tag based on what is being viewed. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * * @return string The filtered title. */ function pixova_lite_wp_title( $title, $sep ) { if ( is_feed() ) { return $title; } global $page, $paged; // Add the blog name $title .= get_bloginfo( 'name', 'display' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title .= " $sep $site_description"; } // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) { $title .= " $sep " . sprintf( __( 'Page %s', 'pixova-lite' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'pixova_lite_wp_title', 10, 2 ); }// End if(). }// End if(). if ( ! function_exists( 'pixova_lite_setup_author' ) ) { /** * Sets the authordata global when viewing an author archive. * * This provides backwards compatibility with * http://core.trac.wordpress.org/changeset/25574 * * It removes the need to call the_post() and rewind_posts() in an author * template to print information about the author. * * @global WP_Query $wp_query WordPress Query object. * @return void */ function pixova_lite_setup_author() { global $wp_query; if ( $wp_query->is_author() && isset( $wp_query->post ) ) { $GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author ); } } add_action( 'wp', 'pixova_lite_setup_author' ); } // Function to convert hex color codes to rgba if ( ! function_exists( 'pixova_lite_hex2rgba' ) ) { function pixova_lite_hex2rgba( $color, $opacity = false ) { $default = 'rgb(0,0,0)'; //Return default if no color provided if ( empty( $color ) ) { return $default; } //Sanitize $color if "#" is provided if ( '#' == $color[0] ) { $color = substr( $color, 1 ); } //Check if color has 6 or 3 characters and get values if ( strlen( $color ) == 6 ) { $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); } elseif ( strlen( $color ) == 3 ) { $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); } else { return $default; } //Convert hexadec to rgb $rgb = array_map( 'hexdec', $hex ); //Check if opacity is set(rgba or rgb) if ( $opacity ) { if ( abs( $opacity ) > 1 ) { $opacity = 1.0; } $output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')'; } else { $output = 'rgb(' . implode( ',', $rgb ) . ')'; } //Return rgb(a) color string return $output; } }// End if(). if ( ! function_exists( 'pixova_lite_post_nav' ) ) { /** * Display navigation to next/previous post when applicable. */ function pixova_lite_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } } // Don't print empty markup in archives if there's only one page. if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) { return; } $nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation'; ?> get_breadcrumbs(); } } if ( ! function_exists( 'pixova_lite_fix_responsive_videos' ) ) { /* /* Add responsive container to embeds */ function pixova_lite_fix_responsive_videos( $html ) { return '
' . $html . '
'; } add_filter( 'embed_oembed_html', 'pixova_lite_fix_responsive_videos', 10, 3 ); add_filter( 'video_embed_html', 'pixova_lite_fix_responsive_videos' ); // Jetpack } if ( ! function_exists( 'pixova_lite_get_number_of_comments' ) ) { /** * Simple function used to return the number of comments a post has. */ function pixova_lite_get_number_of_comments( $post_id ) { $num_comments = get_comments_number( $post_id ); // get_comments_number returns only a numeric value if ( comments_open() ) { if ( 0 == $num_comments ) { $comments = __( 'No Comments', 'pixova-lite' ); } elseif ( $num_comments > 1 ) { $comments = $num_comments . __( ' Comments', 'pixova-lite' ); } else { $comments = __( '1 Comment', 'pixova-lite' ); } $write_comments = '' . $comments . ''; } else { $write_comments = __( 'Comments are off for this post.', 'pixova-lite' ); } return $write_comments; } } if ( ! function_exists( 'pixova_lite_pagination' ) ) { /** * Custom pagination function * * @since Pixova Lite 1.09 */ function pixova_lite_pagination() { $prev_arrow = is_rtl() ? '→' : '←'; $next_arrow = is_rtl() ? '←' : '→'; global $wp_query; $total = $wp_query->max_num_pages; $big = 999999999; // need an unlikely integer $current_page = get_query_var( 'paged' ); if ( $total > 1 ) { if ( ! $current_page ) { $current_page = 1; } if ( get_option( 'permalink_structure' ) ) { $format = 'page/%#%/'; } else { $format = '&paged=%#%'; } echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => $format, 'current' => max( 1, get_query_var( 'paged' ) ), 'total' => $total, 'mid_size' => 3, 'type' => 'list', 'prev_text' => $prev_arrow, 'next_text' => $next_arrow, ) ); } } }// End if(). # Check if it's an IIS powered server if ( ! function_exists( 'pixova_lite_on_iis' ) ) { /** * @return bool */ function pixova_lite_on_iis() { $s_software = strtolower( $_SERVER['SERVER_SOFTWARE'] ); if ( strpos( $s_software, 'microsoft-iis' ) !== false ) { return true; } else { return false; } } } # # Get the page ID of the page using the blog template # # We can't rely on the name, maybe they'll name it something other than 'Blog' ? # if ( ! function_exists( 'pixova_lite_get_page_id_by_template' ) ) { function pixova_lite_get_page_id_by_template( $page_template = null ) { # default args array # page template defaults to blog-template.php $args = array( 'post_type' => 'page', 'fields' => 'ids', 'nopaging' => true, 'meta_key' => '_wp_page_template', 'meta_value' => 'page-templates/blog-template.php', ); $pages = get_posts( $args ); $pages_which_use_template = ''; if ( is_array( $pages ) ) { $pages_which_use_template = array(); foreach ( $pages as $page ) { $pages_which_use_template[] = $page; } } elseif ( ! is_array( $pages ) ) { $pages_which_use_template = $pages; } else { $pages_which_use_template = ''; } return $pages_which_use_template; } } # # Custom Excerpt Length # function pixova_lite_excerpt_length( $length ) { return 75; } add_filter( 'excerpt_length', 'pixova_lite_excerpt_length', 999 ); # # Custom Read More # function pixova_lite_excerpt_more( $more ) { $return_string = '
'; $return_string .= '' . __( 'Read more', 'pixova-lite' ) . ''; $return_string .= '
'; return $return_string; } add_filter( 'excerpt_more', 'pixova_lite_excerpt_more' ); if ( ! function_exists( 'pixova_lite_nice_debug' ) ) { function pixova_lite_nice_debug( $var, $type = 'print_r' ) { switch ( $type ) { case 'print_r': echo '
';
				print_r( $var );
				echo '
';

				break;
			case 'var_dump':
				echo '
';
				var_dump( $var );
				echo '
';

				break;
		}
	}
}

if ( ! function_exists( 'pixova_lite_get_customizer_image_by_url' ) ) {
	/**
	 * Function used to get image ID from URL
	 * This allows us to get the resized version of an image used in the Customizer.
	 *
	 * @since Pixova Lite 1.39
	 */
	function pixova_lite_get_customizer_image_by_url( $value, $image_size = '' ) {

		$id = attachment_url_to_postid( $value );

		if ( $image_size ) {
			$thumb = wp_get_attachment_image_src( $id, $image_size );
		} else { // return full size otherwise
			$thumb = wp_get_attachment_image_src( $id, 'full' );
		}

		return esc_url( $thumb[0] );

	}
}