Only show modified date if updated after a month (or later)
-
Hello! I am using this code to show both the published and modified date on my blogposts:
function astra_post_date() { $format = apply_filters('astra_post_date_format', ''); $published = esc_html(get_the_date($format)); $modified = esc_html(get_the_modified_date($format)); $output = '<p class="posted-on">'; $output .= 'Gepubliceerd op: <span class="published" '; $output .= 'itemprop="datePublished">' . $published; $output .= '</span><br>'; $output .= 'Laatst bijgewerkt op: <span class="updated" '; $output .= 'itemprop="dateModified">' . $modified . '</span>'; $output .= '</p>';} return apply_filters('astra_post_date', $output); add_filter('astra_single_post_meta', 'custom_post_meta'); function custom_post_meta($old_meta) { $post_meta = astra_get_option('blog-single-meta'); if (!$post_meta) return $old_meta; $new_output = astra_get_post_meta($post_meta, ""); if (!$new_output) return $old_meta; return "<div class='entry-meta'>$new_output</div>"; }
However, I would like to only show the modified date if the blogpost was updated 1 month after publishing.
So if I publish a post on 1 feb, and update it on 6 feb, it won’t show ‘updated on’.
But if I publish it on 1 feb and update it on march 1 or later, it will.
P.S. I got this code from some other page (I don’t remember) because I don’t know anything about javascript, so please explain in layman’s terms.
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Only show modified date if updated after a month (or later)’ is closed to new replies.