Home › Forums › Pro Support › Updated Date Meta from GeneratePress
Tagged: meta
This topic contains 21 replies, has 2 voices, and was last updated by Tom 1 year, 7 months ago.
-
AuthorPosts
-
March 15, 2018 at 9:19 pm #3874
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,
ToddMarch 18, 2018 at 9:42 pm #3913Hi Todd,
Any chance you can link me to one of your pages built with WPSP?
Thanks! 🙂
March 18, 2018 at 10:16 pm #3916Same 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/March 19, 2018 at 8:56 pm #3920I 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 🙂
March 20, 2018 at 7:19 am #3924Thanks Tom, when I added that filter to my snippets it causes a 500 – Internal Server Error when I turn on the snippet.
March 20, 2018 at 9:28 pm #3928Sorry about that! Can you try the updated code?
March 20, 2018 at 10:03 pm #3930I am not seeing any updated code?
March 21, 2018 at 9:24 pm #3939I edited the block above: https://wpshowposts.com/support/topic/updated-date-meta-from-generatepress/#post-3920
March 22, 2018 at 6:28 am #3946Thanks 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?
March 22, 2018 at 8:44 pm #3949Made one more edit. If it doesn’t work, I’ll login and take a look 🙂
March 23, 2018 at 8:00 am #3955Thanks, that got rid of the array and it is displaying the date but still not the updated date.
March 23, 2018 at 9:06 pm #3959Grr, 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.
April 3, 2018 at 6:39 am #4074I 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/April 4, 2018 at 9:44 pm #4102I’m seeing the updated date. Perhaps try clearing your browser cache?
April 9, 2018 at 10:32 am #4149I 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/8fa79325ff6332ecbab53912a88ef508Thank you.
-
AuthorPosts
You must be logged in to reply to this topic.