Last active
June 26, 2017 06:43
-
-
Save kadai/014357ee5bbc8f0bf0607378d677374c to your computer and use it in GitHub Desktop.
Functions to add to the functions.php to change "Top Posts" widget from Jetpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* MODIFICAMOS EL TIEMPO A CONSIDERAR PARA EL "TOP POSTS" */ | |
function jetpackcustom_new_timeframe() { | |
/* CONSIDERAREMOS 30 DÍAS */ | |
return '30'; | |
} | |
add_filter( 'jetpack_top_posts_days', 'jetpackcustom_new_timeframe' ); | |
/** | |
* WIDGET TOP POSTS: AGREGAMOS LA FECHA AL FINAL | |
*/ | |
function jetpackcustom_new_adddate( $post_id ) { | |
$post_date = get_post_time( | |
get_option( 'date_format' ), | |
true, | |
$post_id, | |
true | |
); | |
printf( '<div class="top_posts_date widgets-list-layout-links">%s</div>', $post_date ); | |
} | |
add_action( 'jetpack_widget_top_posts_after_post', 'jetpackcustom_new_adddate' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment