- This topic has 15 replies, 3 voices, and was last updated 1 year, 7 months ago by Fernando.
-
AuthorPosts
-
September 18, 2022 at 10:57 pm #2347026MD Tohidul
Hello I want to show post published and Updated date on my every article of my website like this – (check screenshot) – https://prnt.sc/7dCgk6WHG-Bq
How can I do this?
September 18, 2022 at 11:41 pm #2347045Fernando Customer SupportHello there,
Can you provide the link to the site in question? We’ll check your structure and think of an appropriate approach.
You may use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
September 19, 2022 at 8:13 am #2347607MD TohidulHello Please check the private link
September 19, 2022 at 11:37 am #2347766YingStaffCustomer SupportHi there,
Are you using any custom function or plugin to show the updated date on the blog page?
If so, can you share the function?
September 19, 2022 at 9:23 pm #2348046MD TohidulI am using the following code:
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”>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 );September 19, 2022 at 10:36 pm #2348072Fernando Customer SupportYour code is good. Your sample screenshot showing your desired output shows only the updated date. To clarify, are you wanting to modify it to show both published and updated dates if the post has been updated?
September 19, 2022 at 11:06 pm #2348087MD TohidulDear, when I go homepage or any category page of my website, I see the published and updated date.
Check screenshot >>> https://prnt.sc/AmMcoVUNVmh0But, when I enter into the post link, I don’t see any date there. Only writer name is showing there.
Check screenshot >>> https://prnt.sc/bFXZLEOZc-8qI just want to show article published and updated date beside writer name.
For example please check the screenshot: https://prnt.sc/4siHMVGRkt9i
September 19, 2022 at 11:25 pm #2348101Fernando Customer SupportIn Appearance > Customize > Layout > Blog > Single, can you check if “Display Post date” is enabled?
September 20, 2022 at 12:29 am #2348149MD TohidulThat’s perfect, after enabling the option now published and updated date is showing in my every single post.
But, how can I do the same thing for my website page?
Also, let me know how I can change the alignment of my website – post title, page title, author name, published date etc?
September 20, 2022 at 12:32 am #2348154Fernando Customer SupportWhat website page are you referring to?
Well, to make things easier, you can use a Post Meta – Block Element: https://docs.generatepress.com/article/block-element-post-meta-template/
Alternatively, you can also use a Page Hero – Block Element: https://docs.generatepress.com/article/block-element-page-hero/
September 20, 2022 at 3:35 am #2348277MD TohidulPlease check the screenshot: https://prnt.sc/uKntknKRqdci
This article is posted by post option in WordPress. And, It is showing the post published/updated date. That’s Great!And, check this screenshot: https://prnt.sc/rBSDtaOWquv-
This article is posted by page option in WordPress. And, It doesn’t showing the post published/updated date.How can I show page author/published date in the article, which posted through page option?
September 20, 2022 at 10:42 am #2348747YingStaffCustomer SupportHi there,
To add date to static pages, go to appearance > elements, create a new hook element, add this:
<div class="entry-meta"> <?php generate_posted_on(); ?> </div>
Make sure the
Execute PHP
box is ticked.Choose
pages > all pages
as location, and publish the element.September 20, 2022 at 8:34 pm #2349017MD TohidulAfter putting the code, here you see the result: https://prnt.sc/WEqibFE8luEN
It’s showing in the upper section of my website page.
How I can show the date after my website page title?
like this – https://prnt.sc/QKhfYjsduCMxSeptember 20, 2022 at 10:37 pm #2349064Fernando Customer SupportTry to change the hook to
generate_after_entry_header
.For reference, here’s a visual guide of some hooks you may use: https://docs.generatepress.com/article/hooks-visual-guide/#static-page
September 22, 2022 at 12:01 am #2350273MD TohidulThanks dear, problem solved !
-
AuthorPosts
- You must be logged in to reply to this topic.