[Resolved] Published or Updated Text and Icon for Date

Home Forums Support [Resolved] Published or Updated Text and Icon for Date

Home Forums Support Published or Updated Text and Icon for Date

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #1389391
    David
    Staff
    Customer Support

    Use this snippet instead:

    add_filter( 'generate_post_date_output', function( $output, $time_string ) {
    	
        // Set Published Date string
        $label = 'Published: ';
        $time_string = '<span class="date-label">%5$s</span><time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    	
        // Compare updated and published dates
        $updated_time = get_the_modified_time( 'U' );
        $published_time = get_the_time( 'U' ) + 86400;
    	
        // If updated then update Date string
        if ( $updated_time > $published_time ) {
            $time_string = '<span class="date-label">%5$s</span><time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">%4$s</time>';
            $label = 'Last Updated: ';
        }
    
        $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() ),
            $label
        );
    
        return sprintf( '<span class="posted-on">%s</span> ',
            $time_string
        );
    }, 10, 2 );

    And add this CSS:

    .entry-meta .author-name,
    .entry-meta .date-label {
        font-weight: 700;
    }
    #1389435
    Rohan Verma

    Thanks David. Seems good now.

    Another thing I need to ask.

    1. How can I change the single post category box text color?
    2. For multiple categories, it shows in (comma) format like – News, Games. I want to show separate category boxes.
    Current Look: https://www.gadgetheadline.com/ios-14-beta-4-whats-new/

    I’m using this CSS.

    .cat-links {
    background: #f6f4ff;
    padding: 6px 6px 6px;
    margin-right: 6px;
    border-radius: 2px;
    font-weight: 700;
    font-size: 15px;
    text-transform: normal;
    border-left: 0px solid;
    }

    #1389442
    David
    Staff
    Customer Support

    Can you raise a new topic so we can Resolve this one please

    #1389633
    Rohan Verma

    Okay.

    #1389643
    David
    Staff
    Customer Support

    Thanks

Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.