' . esc_html( get_the_author() ) . ''; } } if ( !function_exists( 'centu_posted_on' ) ) { function centu_posted_on() { $time_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); echo '' . $time_string . '';// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } if ( !function_exists( 'centu_entry_category' ) ) { function centu_entry_category() { $icon = centu_get_icon_svg('archive',16); // Hide category and tag text for pages. if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( ', ' ); if ( $categories_list && centu_categorized_blog() ) { printf( ''.$icon.' ' . $categories_list . '' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } } } if ( !function_exists( 'centu_entry_tags' ) ) { function centu_entry_tags() { $icon = centu_get_icon_svg('tag',16); // Hide category and tag text for pages. if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $tag_list = get_the_tag_list( '', ', ' ); if ( $tag_list && centu_categorized_blog() ) { printf( ''.$icon.' ' . $tag_list . '' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } } } if ( !function_exists( 'centu_entry_comment' ) ) { function centu_entry_comment() { if ( !is_single() && !post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( esc_html__( '0 comment', 'centu' ), esc_html__( '1 Comment', 'centu' ), esc_html__( '% Comments', 'centu' ) ); echo ''; } } } if ( !function_exists( 'centu_entry_image' ) ) { function centu_entry_image( $thumb_size = 'medium' ) { if ( has_post_thumbnail() ) : $image = wp_get_attachment_image_src( get_post_thumbnail_id(), $thumb_size ); ?>
<?php echo esc_attr( get_the_title() ); ?>
ID ); if ( $categories ) { $caegory_ids = array(); foreach ( $categories as $category ) { $caegory_ids[] = $category->term_id; } $args = array( 'category__in' => $caegory_ids, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 3, ); $query = new WP_Query( $args ); if ( $query->have_posts() ): echo '
'; echo '

' . esc_html__( 'Related Posts', 'centu' ) . '

'; echo '
'; endif; wp_reset_postdata(); } } } /* Convert hexdec color string to rgb(a) string */ if ( !function_exists( 'centu_hex2rgb' ) ) { function centu_hex2rgb( $hex ) { $hex = str_replace( "#", "", $hex ); if ( strlen( $hex ) == 3 ) { $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) ); $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) ); $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) ); } else { $r = hexdec( substr( $hex, 0, 2 ) ); $g = hexdec( substr( $hex, 2, 2 ) ); $b = hexdec( substr( $hex, 4, 2 ) ); } $rgb = array( $r, $g, $b ); //return implode(",", $rgb); // returns the rgb values separated by commas return $rgb; // returns an array with the rgb values } } if ( !function_exists( 'centu_rgb2hex' ) ) { function centu_rgb2hex( $rgb ) { $hex = "#"; $hex .= str_pad( dechex( $rgb[ 0 ] ), 2, "0", STR_PAD_LEFT ); $hex .= str_pad( dechex( $rgb[ 1 ] ), 2, "0", STR_PAD_LEFT ); $hex .= str_pad( dechex( $rgb[ 2 ] ), 2, "0", STR_PAD_LEFT ); return $hex; // returns the hex value including the number sign (#) } } if ( !function_exists( 'centu_check_hex' ) ) { function centu_check_hex( $color ) { if ( substr( $color, 0, 1 ) == '#' ) { return true; } else { return false; } } } if ( !function_exists( 'centu_color_luminance' ) ) { function centu_color_luminance( $hex, $percent = 1 ) { // validate hex string $hex = preg_replace( '/[^0-9a-f]/i', '', $hex ); $new_hex = '#'; if ( strlen( $hex ) < 6 ) { $hex = $hex[ 0 ] + $hex[ 0 ] + $hex[ 1 ] + $hex[ 1 ] + $hex[ 2 ] + $hex[ 2 ]; } // convert to decimal and change luminosity for ( $i = 0; $i < 3; $i++ ) { $dec = hexdec( substr( $hex, $i * 2, 2 ) ); $dec = min( max( 0, $dec + $dec * $percent ), 255 ); $new_hex .= str_pad( dechex( $dec ), 2, 0, STR_PAD_LEFT ); } return $new_hex; } } if ( !function_exists( 'centu_parseRGBa' ) ) { function centu_parseRGBa( $rgba ) { $rgba = trim( str_replace( ' ', '', $rgba ) ); if ( stripos( $rgba, 'rgba' ) !== false ) { $res = sscanf( $rgba, "rgba(%d, %d, %d, %f)" ); } else { $res = sscanf( $rgba, "rgb(%d, %d, %d)" ); $res[] = 1; } return array_combine( array( '0', '1', '2', '3' ), $res ); } } if ( !function_exists( 'centu_darken_color' ) ) { function centu_darken_color( $skin_color, $percent ) { if ( !centu_check_hex( $skin_color ) ) { $rgba_array = centu_parseRGBa( $skin_color ); $skin_color = centu_rgb2hex( $rgba_array ); } return centu_color_luminance( $skin_color, $percent ); } } if ( !function_exists( 'centu_excerpt' ) ) { function centu_excerpt( $content, $letter_count = 100 ) { $content = strip_shortcodes( $content ); $content = strip_tags( $content ); $new_content = mb_substr( $content, 0, $letter_count ); if ( strlen( $content ) > strlen( $new_content ) ) { $new_content .= "..."; } return $new_content; } } function centu_comment( $comment, $args, $depth ) { $tag = ( 'div' === $args[ 'style' ] ) ? 'div' : 'li'; ?> < id="comment-" >
'div-comment', 'depth' => $depth, 'max_depth' => $args[ 'max_depth' ], 'before' => '
'.$reply_icon, 'after' => '
' ) ) ); ?>
"", // Strip C style comments. "#\s\s+#" => " ", // Strip excess whitespace. ); $search = array_keys( $replace ); $css = preg_replace( $search, $replace, $css ); $replace = array( ": " => ":", "; " => ";", " {" => "{", " }" => "}", ", " => ",", "{ " => "{", ";}" => "}", // Strip optional semicolons. ",\n" => ",", // Don't wrap multiple selectors. "\n}" => "}", // Don't wrap closing braces. //"} " => "}\n", // Put each rule on it's own line. ); $search = array_keys( $replace ); $css = str_replace( $search, $replace, $css ); return trim( $css ); } } /* prevent undefined function error if redux-framework plugin is not activated */ function centu_get_redux_post_meta( $key, $default_value = '' ) { global $post; if ( function_exists( 'redux_post_meta' ) ) { return redux_post_meta( 'centu_options', $post->ID, $key ); } else { return $default_value; } }