Hi @psonetz,
I’ve been meaning to make it easier to modify the post meta output in Chaplin for a while, and your question nudged me to get around to it, so kudos for that. When you’ve updated to version 2.4.0 of Chaplin, which should be live in a bit, you’ll be able to add the modified date to the post meta by adding the code below to the functions.php
file in a child theme:
// Post meta: Add the modified_date post meta item to the end of the single top and archive post meta
function chaplin_child_post_meta_add_modified_date( $post_meta ) {
$post_meta[] = 'post-date-modified';
return $post_meta;
}
add_filter( 'chaplin_post_meta_items_single-top', 'chaplin_child_post_meta_add_modified_date' );
add_filter( 'chaplin_post_meta_items_archive', 'chaplin_child_post_meta_add_modified_date' );
// Post meta: Output the modified_date post meta item
function chaplin_child_post_meta_output_modified_date( $post_id, $location ) {
global $has_meta;
$has_meta = true;
?>
<li class="post-date">
<a class="meta-wrapper" href="<?php the_permalink(); ?>">
<span class="meta-icon">
<span class="screen-reader-text"><?php esc_html_e( 'Post modified date', 'chaplin-child' ); ?></span>
<?php chaplin_the_theme_svg( 'calendar' ); ?>
</span>
<span class="meta-text">
<?php printf( __( 'Updated %s', 'chaplin-child' ), get_the_modified_date( get_option( 'date_format' ) ) ); ?>
</span>
</a>
</li>
<?php
}
add_action( 'chaplin_post_meta_post-date-modified', 'chaplin_child_post_meta_output_modified_date', 10, 3 );
Let me know if it works as expected.
— Anders