[Support request] Post date & updated date

Home Forums Support [Support request] Post date & updated date

Home Forums Support Post date & updated date

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #633333
    Laurent

    Hi,

    In some cases, customers wish to see either :
    – post date -> included natively
    – updated date -> not included natively, some articles written about it
    – post date & update date at same time –> my wish & it appears no where

    May I ask you why customers with premium plugin doesn’t have it natevily?

    #633348
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You should be able to do something as simple as this:

    .posted-on .updated {
        display: inline-block;
    }
    
    .posted-on .updated:before {
        content: "Last Updated: "
    }
    
    .posted-on .published:before {
        content: " | Published on: "
    }

    Let me know 🙂

    #633496
    Laurent

    It’s a partial solution.

    I wish Published then Updated. It show the opposite.
    Also Author is display whereas I unchecked it in Premium settings.

    #633696
    Tom
    Lead Developer
    Lead Developer

    You can change the order with this function:

    add_filter( 'generate_post_date_output', function( $output ) {
    	$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_string . '<time class="updated" datetime="%3$s" itemprop="dateModified">%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() )
    	);
    
    	echo sprintf( '<span class="posted-on">%1$s</span>', // WPCS: XSS ok, sanitization ok.
    		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
    			esc_url( get_permalink() ),
    			esc_attr( get_the_time() ),
    			$time_string
    		)
    	);
    } );

    As for the author – do you have any other custom functions added to your site?

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.