rpress_report_dates

Author: RestroPress 342 views

This filter is applied on sets up the dates used to filter graph data
The filter includes one parameter, $dates. By using this filter we can apply more condition to filter the reports on the basis of customized condition.

apply_filters( ‘rpress_report_dates’, $dates );

Example:

function rpress_report_dates_filter( $dates ) {


  switch ( $dates['range'] ) :

       case 'this_month' :
          $dates['m_start'] = date( 'n', $current_time );
          $dates['m_end'] = date( 'n', $current_time );
          $dates['day'] = 1;
          $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
          $dates['year'] = date( 'Y' );
          $dates['year_end'] = date( 'Y' );
      break;

  endswitch;

 return $dates;
}
add_filter( 'rpress_report_dates', 'rpress_report_dates_filter', 20, 1 );