Oh thank u! Look, I better modified toplytics.php and added year range:
public function add_ranges() {
$ranges = array(
'year' => date_i18n( 'Y-m-d', strtotime( '-364 days' ) ),
'month' => date_i18n( 'Y-m-d', strtotime( '-29 days' ) ),
'week' => date_i18n( 'Y-m-d', strtotime( '-6 days' ) ),
'today' => date_i18n( 'Y-m-d', strtotime( 'today' ) ),
);
$this->ranges = apply_filters( 'toplytics_ranges', $ranges );
}
It works properly too! I don’t want to add another php file in the plugin folder so I wanted to do so. For all time could be like this:?
'all time' => date_i18n( 'Y-m-d', strtotime( '-9999 days' ) ),
And can you tell me how would be in a certain time? For example after January 1st or between monday and friday?
And the last one, I saw the faq and tried to use the plugin outside the sidebar and works but not with my own css style like in the widget (I modified the template.php file too!)
I used this code:
<?php
if ( function_exists( 'toplytics_get_results' ) ) {
$toplytics_args = array(
'period' => 'month', // default=month (today/week/month)
'numberposts' => 3 // default=5 (min=1/max=250)
);
$toplytics_results = toplytics_get_results( $toplytics_args );
if ( $toplytics_results ) {
$k = 0;
foreach ( $toplytics_results as $post_id => $post_views ) {
echo (++$k) . ') <a href="' . get_permalink( $post_id )
. '" title="' . esc_attr( get_the_title( $post_id ) ) . '">'
. get_the_title( $post_id ) . '</a> - ' . $post_views . ' Views<br />';
}
}
}
?>
-
This reply was modified 7 years, 10 months ago by vicetias.