Viewing 15 replies - 16 through 30 (of 54 total)
  • Thread Starter Robin

    (@nioriaa)

    Search a content using search bar, then scroll the results.

    you can see: https://prnt.sc/t4m5RNezZ3fs

    Leo

    (@leohsiang)

    Add this CSS;

    .tags-links {
        display: none !important;
    }

    The option is included in our premium plugin as well: https://docs.generatepress.com/article/blog-content-layout/

    Thread Starter Robin

    (@nioriaa)

    Thanks for the code, its working.

    Leo

    (@leohsiang)

    No problem ??

    Thread Starter Robin

    (@nioriaa)

    My website content shows an updated date under the title. https://prnt.sc/waGlMLUVGChs

    How to show published date and updated date both?

    Example: https://prnt.sc/X5oD5CrKoZeE

    ying

    (@yingscarlett)

    Hi @nioriaa ,

    To have the 2 dates shown separately, it will require GP premium or custom development. If you don’t mind the 2 dates sit together, we can help with some CSS solution.

    Let me know ??

    Thread Starter Robin

    (@nioriaa)

    Please, send me the CSS solution.

    ying

    (@yingscarlett)

    /*show updated date if there's one*/
    .posted-on .updated {
        display: block;
    }
    /*add updated on text before the updated date*/
    .posted-on .updated:before {
        content: "Updated on: ";
    }
    /*add published on text before the published date*/
    .posted-on .entry-date.published:before {
        content: "Published on: ";
    }
    Thread Starter Robin

    (@nioriaa)

    The code is not working. Still not showing the published date. https://prnt.sc/vobxJX9ZAl8G

    ying

    (@yingscarlett)

    Can you link me to the post?

    Thread Starter Robin

    (@nioriaa)

    ying

    (@yingscarlett)

    The post date is missing in your HTML. Are you using custom function to only show the updated date?

    Thread Starter Robin

    (@nioriaa)

    yes,

    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_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
            $time_string = '<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 to customize it to show published date too?

    Hi @nioriaa,

    Try using a snippet like this instead:

    add_filter( 'generate_post_date_output', function( $output, $time_string ) {
    	
    $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">Published on %2$s</time>';
    
    if ( get_the_date() !== get_the_modified_date() ) {
    	$time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Updated: %4$s</time>
    	<time class="entry-date published" datetime="%1$s" itemprop="datePublished">Published: %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() )
    );
    
    return sprintf( '<span class="posted-on">%s</span> ',
    $time_string
    );
    }, 10, 2 );
    Thread Starter Robin

    (@nioriaa)

    Thank you for the code.

    The update date and published date are shown in a line together. That’s not looking good for readers. https://prnt.sc/g1Md18rUIEXK

    I want to show them separately to readers.

    Examplehttps://prnt.sc/X5oD5CrKoZeE

    Can you please customize it?

    • This reply was modified 1 year, 2 months ago by Robin.
Viewing 15 replies - 16 through 30 (of 54 total)
  • The topic ‘GP blog site customization’ is closed to new replies.