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 '
'; 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] ); } }