• On my blog, the Shaply theme is showing the date, twice.

    I have not been able to correct this, using custom format as is.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • @dewice, @steveax, and @w.reidlinger, I found a temporary solution add these two functions to your Child Theme and either comment out or remove all reference to get_the_modified in whatever version. The code below is a functioning example.

    path://shapely/inc/template-tags.php
    
    /***********************************TEMP BUG FIX UNTIL UPDATE************************************************
    	 * Prints HTML with meta information for the current post-date/time and author.
    	 */
    	function shapely_posted_on() {
    		$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
    		//if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		//	$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
    		//}
    
    		$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() )
    		); ?>
    
    		<ul class="post-meta">
    		<li><i class="fa fa-user"></i><span><a
    					href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"
    					title="<?php echo esc_attr( get_the_author() ); ?>"><?php esc_html( the_author() ); ?></a></span>
    		</li>
    		<li><i class="fa fa-calendar"></i><span class="posted-on"><?php echo wp_kses_post( $time_string ); ?></span></li>
    		<?php shapely_post_category(); ?>
    		</ul>
    		<?php
    		echo ( is_archive() ) ? '<hr>' : '';
    	}
    
    
     
    	/**if
    	 * Prints HTML with meta information for the current post-date/time and author.
    	 */
    	function shapely_posted_on_no_cat() {
    
    		if ( is_singular( 'jetpack-portfolio' ) ) {
    			$post_author = get_theme_mod( 'project_author', true );
    			$post_date   = get_theme_mod( 'project_date', true );
    		} else {
    			$post_author = get_theme_mod( 'post_author', true );
    			$post_date   = get_theme_mod( 'post_date', true );
    		}
    
    		$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
    		//if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
    		//	$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
    		//}
    
    		$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() )
    		);
    
    		if ( $post_date || $post_author ) :
    		?>
    
    		<ul class="post-meta">
    		<?php if ( $post_date ) : ?>
    			<li><span class="posted-on"><?php echo wp_kses_post( $time_string ); ?></span></li>
    		<?php endif ?>
    		<?php if ( $post_author ) : ?>
    			<li><span><?php echo esc_html__( 'by', 'shapely' ); ?> <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" title="<?php echo esc_attr( get_the_author() ); ?>"><?php esc_html( the_author() ); ?></a></span></li>
    		<?php endif ?>
    		</ul>
    		<?php
    		endif;
    	}
    /***********************************TEMP BUG FIX UNTIL UPDATE************************************************

    great! I will try this… thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘2 x date format on Blog post’ is closed to new replies.