"; } } } function catch_that_image() { global $post, $posts; $first_img = ''; $first_img1 = ''; $first_img2 = ''; $first_img3 = ''; ob_start(); ob_end_clean(); $output = preg_match('/()/i', $post->post_content, $matches); $first_img = "{$matches[1]}{$matches[2]} itemprop=\"image\" id=\"schemaimg\"{$matches[3]}"; $first_img = preg_replace( '#]+[a-z0-9"])[/ ]*>#', "", $first_img ); if(empty($matches[1])) { $first_img = ""; } return "$first_img"; } if ( ! function_exists( 'blogstartpro_datePublished_only' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function blogstartpro_datePublished_only() { $time_only_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_only_string = ''; } $time_only_string = sprintf( $time_only_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_only_string"; } endif; if ( ! function_exists( 'blogstartpro_schema_header' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function blogstartpro_schema_header() { $thePostAuthor = get_the_author(); $thePostAuthor_ID = get_the_author_meta( 'ID' ); if (!$thePostAuthor) { $thePostAuthor_ID = get_post_field( 'post_author', get_the_ID() ); $thePostAuthor = get_the_author_meta( 'display_name', $thePostAuthor_ID ); } echo "$thePostAuthor"; } endif; if ( ! function_exists( 'blogstartpro_get_canonical' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function blogstartpro_get_canonical() { echo get_permalink(); } endif; if ( ! function_exists( 'blogstartpro_get_newTitleTag' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function blogstartpro_get_newTitleTag() { #echo '' . wp_get_document_title() . '' . "\n"; } endif; if ( ! function_exists( 'blogstartpro_get_newMetaDesc' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function blogstartpro_get_newMetaDesc() { echo get_post_meta(get_the_ID(), 'nc_ogDescription', TRUE); } endif; if ( ! function_exists( 'blogstartpro_meta_robots' ) ) : function blogstartpro_meta_robots() { $theseDupOptions = ''; $dupContCure_meta_robots = ''; if(get_option('dupContCure_noindex_options')){ $theseDupOptions = get_option('dupContCure_noindex_options'); $theseDupOptionsArr = explode(",", $theseDupOptions); $theseDupOptionsCat = $theseDupOptionsArr[0]; $theseDupOptionsTag = $theseDupOptionsArr[1]; if($theseDupOptions == 'off,off'){ //Allow Categories and Tags if((is_single() || is_page() || is_home() || is_category() || is_tag()) && (!is_paged()) ){ $dupContCure_meta_robots = "\n"; }else{ $dupContCure_meta_robots = "\n"; } }else if($theseDupOptions == 'off,on'){ //Allow Categories if((is_single() || is_page() || is_home() || is_category()) && (!is_paged()) ){ $dupContCure_meta_robots = "\n"; }else{ $dupContCure_meta_robots = "\n"; } }else if($theseDupOptions == 'on,off'){ //Allow Tags if((is_single() || is_page() || is_home() || is_tag()) && (!is_paged()) ){ $dupContCure_meta_robots = "\n"; }else{ $dupContCure_meta_robots = "\n"; } }else{ //Allow None if((is_single() || is_page() || is_home()) && (!is_paged()) ){ $dupContCure_meta_robots = "\n"; }else{ $dupContCure_meta_robots = "\n"; } } }else{ if((is_single() || is_page() || is_home()) && (!is_paged()) ){ $dupContCure_meta_robots = "\n"; }else{ $dupContCure_meta_robots = "\n"; } } echo $dupContCure_meta_robots; } endif; if ( ! function_exists( 'blogstartpro_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function blogstartpro_posted_on() { $time_string = ''; $schema_time = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; $schema_time = ''; } $schema_time = sprintf( $schema_time, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); $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() ) ); $posted_on = sprintf( esc_html_x( 'Posted on %s', 'post date', 'blogstartpro' ), '' . $time_string . '' ); $byline = sprintf( esc_html_x( 'by %s', 'post author', 'blogstartpro' ), '' . esc_html( get_the_author() ) . '' ); echo '' . $posted_on . ''; // WPCS: XSS OK. //echo $posted_on . ''; // WPCS: XSS OK. echo catch_that_image(); } endif; if ( ! function_exists( 'blogstartpro_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function blogstartpro_entry_footer() { // 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( esc_html__( ', ', 'blogstartpro' ) ); if ( $categories_list && blogstartpro_categorized_blog() ) { printf( '' . esc_html__( 'Posted in %1$s', 'blogstartpro' ) . '', $categories_list ); // WPCS: XSS OK. } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'blogstartpro' ) ); if ( $tags_list ) { printf( '' . esc_html__( 'Tagged %1$s', 'blogstartpro' ) . '', $tags_list ); // WPCS: XSS OK. } } if ( ! is_single() && ! is_home() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { //echo ''; //comments_popup_link( esc_html__( 'Leave a comment', 'blogstartpro' ), esc_html__( '1 Comment', 'blogstartpro' ), esc_html__( '% Comments', 'blogstartpro' ) ); //echo ''; } edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'blogstartpro' ), the_title( '"', '"', false ) ), '', '' ); } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function blogstartpro_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'blogstartpro_categories' ) ) ) { // Create an array of all the categories that are attached to posts. $all_the_cool_cats = get_categories( array( 'fields' => 'ids', 'hide_empty' => 1, // We only need to know if there is more than one category. 'number' => 2, ) ); // Count the number of categories that are attached to the posts. $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'blogstartpro_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so blogstartpro_categorized_blog should return true. return true; } else { // This blog has only 1 category so blogstartpro_categorized_blog should return false. return false; } } /** * Flush out the transients used in blogstartpro_categorized_blog. */ function blogstartpro_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'blogstartpro_categories' ); } add_action( 'edit_category', 'blogstartpro_category_transient_flusher' ); add_action( 'save_post', 'blogstartpro_category_transient_flusher' );