Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    You can use the jetpack_widget_top_posts_after_post action to add data after each post in the widget.

    To get started, you can paste the following code in your theme’s functions.php file, or in a functionality plugin

    /**
     * Top Posts Widget: add post date below each post.
     */
    function jeherve_add_date_top_posts( $post_id ) {
    
            $post_date = get_post_time(
                    get_option( 'date_format' ),
                    true,
                    $post_id,
                    true
            );
    
            printf( '<span class="top_posts_date">%s</span>', $post_date );
    }
    add_action( 'jetpack_widget_top_posts_after_post', 'jeherve_add_date_top_posts' );

    I hope this helps.

    Thread Starter diswell

    (@diswell)

    Hi Jeremy

    It certainly does help and is now installed in my functionality plugin. Many thanks for your support!

    Best wishes for 2016!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add Post Date to Top Posts & Pages Widget’ is closed to new replies.