Site logo

Archived topic

Customise Entry Data

7 replies · Started by Anuar on September 2, 2021

Viewing posts 1–8 of 8

Hi
I am using this code to customize my entry data

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

if ( get_the_date() !== get_the_modified_date() ) {
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">Published on: %2$s</time> | <time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Last Updated on: %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() )
);

return sprintf( '<span class="posted-on">%s</span> ',
$time_string
);
}, 10, 2 );

How I can increase the font contrast ratio?

Thank you
Anrsml

Hi Anrsml,

That is done through CSS. Here's how to add CSS - https://docs.generatepress.com/article/adding-css/

You can set a color manually to contrast its background through this CSS.

span.posted-on time {
color: //set your color value here;
}

Hi Elvin
Thank you for the code, its works for single post but I also want to implement it in achieves section because my Homepage set to latest post.

Regards

CAn you link me to the sample pages where it doesn't work? To inspect and provide the necessary CSS writeup.

Let us know. :D

It doesn't look like the CSS is applied properly. Make sure you remove the //. The double backslash is for comment purposes only.

Example:

span.posted-on time {
    color: #1c1a1a;
}

Hi
Thank you, it works now

Regards
Anrsml

Nice one. Glad you got it sorted. :D

This archived topic is closed to new replies.