We're merging with GenerateBlocks! Learn more here.

[Resolved] Updated Date Meta from GeneratePress

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Updated Date Meta from GeneratePress

Tagged: 

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #3874
    Todd
    Participant

    Hi Tom,

    Continuing to love GeneratePress and WP posts Pro.

    I have been working to set up a test site where I want updated dates on the posts. And I’ve been getting this to work in GeneratePress. Leo just helped me with what might be the final CSS tweak.

    However, this does not seem to transfer to the date metadata for the updated date you can see at the bottom where I have featured posts.

    Is there any way to have this show the updated date from GeneratePress?

    Thank you,
    Todd

    #3913
    Tom
    Keymaster

    Hi Todd,

    Any chance you can link me to one of your pages built with WPSP?

    Thanks! 🙂

    #3916
    Todd
    Participant

    Same site; http://nxts847332.nextsearch.io/

    I just made an update to one of the Tests post below and on the blog page it shows the updated date. I would like it also to reflect this same meta data in the the WPSP at the bottom of the home page.

    10 Ways G Suite Will Save You Hours of Time

    http://nxts847332.nextsearch.io/
    http://nxts847332.nextsearch.io/blog/

    #3920
    Tom
    Keymaster

    I need to make this adjustment in the core plugin, but we can try this for now:

    add_filter( 'wpsp_date_output', 'tu_wpsp_updated_date_first' );
    function tu_wpsp_updated_date_first() {
    	$time_string = '';
    	
    	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</time>';
    	}
    	
    	$time_string .= '<time class="wp-show-posts-entry-date published" datetime="%1$s" itemprop="datePublished">%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() )
    	);
    	
    	// If our date is enabled, show it
    	$output = 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
    	);
    
    	return $output;
    	
    }

    Then add this CSS:

    .wp-show-posts-updated {
        display: inline-block;
    }
    
    .wp-show-posts-updated + .wp-show-posts-entry-date {
        display: none;
    }

    Let me know if that works or not 🙂

    #3924
    Todd
    Participant

    Thanks Tom, when I added that filter to my snippets it causes a 500 – Internal Server Error when I turn on the snippet.

    #3928
    Tom
    Keymaster

    Sorry about that! Can you try the updated code?

    #3930
    Todd
    Participant

    I am not seeing any updated code?

    #3939
    Tom
    Keymaster
    #3946
    Todd
    Participant

    Thanks Tom, but now, when I changed the code for that snippet and now it just shows “array” where the dates goes. See WPSP at the bottom of the page. Would it be helpful for you to have the login?

    http://nxts847332.nextsearch.io/

    #3949
    Tom
    Keymaster

    Made one more edit. If it doesn’t work, I’ll login and take a look 🙂

    #3955
    Todd
    Participant

    Thanks, that got rid of the array and it is displaying the date but still not the updated date.

    #3959
    Tom
    Keymaster

    Grr, sorry. I missed something in the code.

    This will do it: https://wpshowposts.com/support/topic/updated-date-meta-from-generatepress/#post-3920

    Then it may need a little CSS, but the above will at least get the HTML to where we need it to be.

    #4074
    Todd
    Participant

    I updated both the snippet and the CSS and it does not show “updated” on the WPSP block. It does show this on the post itself.

    http://nxts847332.nextsearch.io/
    http://nxts847332.nextsearch.io/how-to-use-semrush-for-competitive-intelligence/

    #4102
    Tom
    Keymaster

    I’m seeing the updated date. Perhaps try clearing your browser cache?

    #4149
    Todd
    Participant

    I am seeing the update date on the Posts but not in WPSP like you can see at the Bottom of the home page? I cleared Cache and tried it in an incogonito browser.

    http://nxts847332.nextsearch.io/
    https://www.awesomescreenshot.com/image/3286085/8fa79325ff6332ecbab53912a88ef508

    Thank you.

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