Fires before each Top Post result, inside .
Parameters
- $post
string ['post_id'] Post ID.
Changelog
- Introduced in Jetpack 3.2.0
How to use this hook
Notes
You can use this action to add data before each post in the widget. In the example below, we’ll insert the post date above each post:
function jetpackme_add_date_top_posts( $post_id ) {
$post_date = get_post_time(
get_option( 'date_format' ),
true,
$post_id,
true
);
printf( '<div class="top_posts_date">%s</div>', $post_date );
}
add_action( 'jetpack_widget_top_posts_before_post', 'jetpackme_add_date_top_posts' );