We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Showing time as well as date? Reply To: Showing time as well as date?

#7482
Matthew
Participant

Hey

Yeah of course, the code I am using is as follows:

add_filter( 'wpsp_date_output', function( $output ) {
    $time_string = '<time class="wp-show-posts-entry-date published" datetime="%1$s" itemprop="datePublished">%2$s, %5$s</time>';

    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, %5$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() ),
        get_the_date( 'g:ia' )
    );

    return 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
    );
} );

The code get_the_date( 'g:i a' ) only seems to be for the time part.

If you look here – https://www.ukairdates.com at the latest TV shows news at the top of the page it shows the date and time.

I want to customise how the date looks.

Thanks for any help you can provide!