sidebar
2 months ago
appearance.php
2 months ago
date-custom-range-filter.php
2 months ago
demo-popup.php
2 months ago
demographic-chart.php
2 months ago
demographic.php
2 months ago
exclusions.php
2 months ago
ga4-dashboard.php
2 months ago
ga4-demographic-chart.php
2 months ago
gdpr-config.php
2 months ago
gdpr.php
2 months ago
purposes.php
2 months ago
date-custom-range-filter.php
35 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Custom Date Range Filter template. |
| 4 | * |
| 5 | * @package GoogleAnalytics |
| 6 | */ |
| 7 | |
| 8 | if (!defined('ABSPATH')) exit; |
| 9 | |
| 10 | $args = isset( $args ) ? $args : array(); |
| 11 | |
| 12 | $props = wp_parse_args( |
| 13 | $args, |
| 14 | array( |
| 15 | 'date_from' => gmdate( 'Y-m-d', strtotime( '-1 week' ) ), |
| 16 | 'date_to' => gmdate( 'Y-m-d' ), |
| 17 | ) |
| 18 | ); |
| 19 | |
| 20 | $date_from = false === empty( $props['date_from'] ) ? $props['date_from'] : gmdate( 'Y-m-d', strtotime( '-1 week' ) ); |
| 21 | $date_to = false === empty( $props['date_to'] ) ? $props['date_to'] : gmdate( 'Y-m-d' ); |
| 22 | ?> |
| 23 | <form action="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>" method="GET"> |
| 24 | <input type="hidden" name="page" value="googleanalytics"/> |
| 25 | <label> |
| 26 | <?php esc_html_e( 'From:', 'googleanalytics' ); ?> |
| 27 | <input name="date_from" type="date" value="<?php echo esc_attr( $date_from ); ?>"> |
| 28 | </label> |
| 29 | <label> |
| 30 | <?php esc_html_e( 'To:', 'googleanalytics' ); ?> |
| 31 | <input name="date_to" type="date" value="<?php echo esc_attr( $date_to ); ?>"> |
| 32 | </label> |
| 33 | <button><?php esc_html_e( 'Filter', 'googleanalytics' ); ?></button> |
| 34 | </form> |
| 35 |