Added dates to Pupular Posts, how to style?
-
Hi!
I’ve just added a snippet of code to add a date to my popular posts widget, it worked, but the text output of the code could use some styling.
My site is (Swedish): https://jennyelisabeth.se
The popular posts widget is “Popul?ra inl?gg & sidor”.How do I style it so that the date is underneath the title of the post/page?
And also, is there a way to edit the code so that it says “x days ago” instead of the date?The code snippet I’m using is this:
/** * Top Posts Widget: add post date below 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_after_post', 'jetpackme_add_date_top_posts' );
I am using a plugin called Code Snippets to edit the code.
I am also using Jetpack’s Custom CSS option.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Added dates to Pupular Posts, how to style?’ is closed to new replies.