Skip to content

Instantly share code, notes, and snippets.

@kadai
Last active June 26, 2017 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadai/014357ee5bbc8f0bf0607378d677374c to your computer and use it in GitHub Desktop.
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
<?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