Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Functions to add to the functions.php to change "Top Posts" widget from Jetpack
<?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
You can’t perform that action at this time.