Black Friday sale! Get 25% off WPSP Pro! Discount automatically applied at checkout.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Created date on first publish, updated date on update after Reply To: Created date on first publish, updated date on update after

#9871
Daniel
Participant

I created a new post and I see “Updated on ” + date, not “Created on ” + date. (In French, “Publié le ” + “Mis à jour le “)

Here is all I have done trying to make it work.

I created the following code snippet:


add_filter( 'wpsp_date_output', 'tu_wpsp_updated_date_first' );
function tu_wpsp_updated_date_first() {
	$time_string = '';
	
	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
		$time_string .= '<time class="wp-show-posts-updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
	}
	
	$time_string .= '<time class="wp-show-posts-entry-date published" datetime="%1$s" itemprop="datePublished">%2$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 our date is enabled, show it
	$output = sprintf(
		'<span class="wp-show-posts-posted-on wp-show-posts-meta">
			<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>
		</span>',
		esc_url( get_permalink() ),
		esc_attr( get_the_time() ),
		$time_string
	);

	return $output;
	
}

I added the following custom CSS:


/* Created after updated date */
.wp-show-posts-updated {
    display: inline-block;
}

.wp-show-posts-updated + .wp-show-posts-entry-date {
    display: none;
}

/* Created after updated date label */
.wp-show-posts-entry-date:before {
    content: "Publié le ";
}

.wp-show-posts-updated:before {
    content: "Mis à jour le ";
}

I commented any previous CSS customization attempt.