Archived topic
i use "Only Show Updated Date", but in "latest post" not showing
17 replies · Started by Atefan on January 10, 2021
Hello,
I used this, to show the latest update date on the post, works!
first-line only, as time icon did not work
https://docs.generatepress.com/article/generate_post_date_output/#only-show-updated-date
but when I go to the index page to use the "Latest Post", it shows only the Publishing date post and not the new update post.
how can I archive this?
Hi there,
are you using a shortcode to display the Post date on your index ? If so can you share the code you used to create the shortcode ?
Hi David, I just added now WP Show Posts, with his shortcode option, for page and post.
but removed date, as it shows than published date, not latest updated date. looks a bit wired.
For Show Posts, you can use the latest development version: https://wpshowposts.com/wp-show-posts-1-2-0/
Then use this filter:
add_filter( 'wpsp_post_date_show_updated_only', '__return_true' );
Hi Tom,
i installed the beta version and replaced
add_filter( 'generate_post_date_show_updated_only', '__return_true' );
with yours
I do not see any difference to be true.
not on-page and not on this updated plugin, looks the same to me.
I am only see WPSP in the footer widgets, the date at the top of page is not being output by WPSP its inside a GenerateBlocks Block - is that the date that requires changing?
Hi David,
On top it's just a date stamp.
What I'm looking for is the date stamp to the updated post and pages created by WPSP down.
It pulls the updated post and pages, but no showing timestamp, as you see the big gap in between titles. It is blank.
Hi there,
I just tried to load your site but it seems to be down. Can you check?
it's running on my end.
Tom,
have you been able?
Loading now. Can you re-add the date to the list so I can see why it's not working?
it has been ticked before and still now
https://pasteboard.co/JJkvFgz.png
or it have to do something with that:
.home .entry-meta {
display: none;
}
as I place this to remove the update in home.
but even when I remove the code, it does not show up, only the page update shows again.
You have this CSS which is stopping it from showing up:
.wp-show-posts-updated {
display: none;
}
The date itself is the updated date (which is why that CSS is working), so the PHP is all working as it should.
Hi Tom
this is how my
<--- sticky sidebar--->
@media (min-width: 769px) {
.site-content {
display: flex;
}
.inside-right-sidebar {
height: 100%;
}
.inside-right-sidebar aside:last-child {
position: -webkit-sticky;
position: sticky;
top: 70px;
}
}
<--- end sticky sidebar--->
<--- start button--->
.button.ghost, .button.ghost:visited {
background: transparent;
border: 2px solid #FBB93E;
}
.button.ghost:hover,
.button.ghost:active {
background: #FBB93E;
color: #222222;
border: 2px solid transparent;
}
<--- end button--->
<--- start site logo--->
.site-logo img {
width: 350px;
height: 70px;
}
<--- end site logo--->
<--- start h1 tag padding--->
.single-post.full-width-content .entry-header,
.single-post.full-width-content footer.entry-meta {
max-width: 1200px;
padding-left: 40px;
padding-right: 40px;
margin: auto;
}
.single-post.full-width-content footer.entry-meta {
padding-bottom: 40px;
}
<--- end h1 tag padding--->
<--- start next previous alignment--->
.post-navigation {
display: flex;
}
.post-navigation .nav-next {
width: 50%;
text-align: right;
display: flex;
flex-direction: row-reverse;
}
.post-navigation .nav-previous {
width: 50%;
}
.nav-next .gp-icon {
margin-left: .6em;
margin-right: 0;
}
<--- end next previous alignment--->
<--- start capcha hidden--->
.grecaptcha-badge {visibility: hidden;}
<--- endcapcha hidden--->
<--- start hide date in frontpage--->
.home .entry-meta {
display: none;
}
<--- end start hide date in frontpage--->
additional CSS looks like, I do not see your code there and not in PHP
?php
/**
* GeneratePress child theme functions and definitions.
*
* Add your custom PHP in this file.
* Only edit this file if you have direct access to it on your server (to fix errors if they happen).
*/
/**
* updated date on post
*/
add_filter( 'wpsp_post_date_show_updated_only', '__return_true' );
/**
* Page date to page
*/
add_action( 'generate_after_entry_header', 'tu_page_meta' );
function tu_page_meta() {
if ( is_singular( 'page' ) ) : ?>
<div class="entry-meta">
<?php generate_posted_on(); ?>
</div><!-- .entry-meta -->
<?php endif;
}
/**
* Date to frontpage
*/
add_shortcode( 'footer_date', 'lh_footer_date' );
function lh_footer_date() {
ob_start();
echo date('d.m.Y');
return ob_get_clean();
}
/**
* remove website field in comments
*/
add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );
function tu_add_comment_url_filter() {
add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );
}
function tu_disable_comment_url($fields) {
unset($fields['url']);
return $fields;
}
I use the child theme