Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dates are duplicated #334

Open
nodarik opened this issue Jul 13, 2022 · 2 comments
Open

Dates are duplicated #334

nodarik opened this issue Jul 13, 2022 · 2 comments

Comments

@nodarik
Copy link

nodarik commented Jul 13, 2022

Posts showing dates as duplicated in a single post: https://prnt.sc/uNoztQ0OriCX
For more check this link: https://colorlibsupport.com/t/the-date-of-blog-post-shows-two-dates/32608

@Athanas7a
Copy link

I had the same issue but I found a temporary fix: Wordpress Dashboard > Appearance > Theme File Editor: //shapely/inc/template-tags.php
And then you edit the first 82 lines as follows:

<?php
/**
 * Custom template tags for this theme.
 *
 * Eventually, some of the functionality here could be replaced by core features.
 *
 * @package Shapely
 */

if ( ! function_exists( 'shapely_posted_on' ) ) :
	/**
	 * 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>' : '';
	}
endif;

if ( ! function_exists( 'shapely_posted_on_no_cat' ) ) :
	/**
	 * 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;
	}
endif;

[continues...]

This comments out the parts that checks and parses the dates the post was modified.

@wreidlinger
Copy link

wreidlinger commented Jun 3, 2024

@Athanas7a thanks for your bugfix! It worked like a charm.
Quite sad that the official "creator" of this theme is not able to fix this easy issue with an update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants