Created
May 1, 2023 22:52
-
-
Save elearningplugins/4783b0b4bdec3f94ced3d9bd62cbf6dd to your computer and use it in GitHub Desktop.
AFL WC UTM First Referrer and Landing Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: AFL WC UTM First Referrer and Landing Page | |
Description: Adds the "First Website Referrer" and "First Landing Page" attributes as columns on the page=afl-wc-utm-reports. | |
Author: Brian Batt | |
Version: 1.0 | |
*/ | |
if (!defined('ABSPATH')) { | |
exit; // Exit if accessed directly. | |
} | |
function afl_wc_utm_first_referrer_column($columns) { | |
$columns['first_website_referrer'] = __('First Website Referrer', 'afl-wc-utm-first-referrer'); | |
$columns['first_landing_page'] = __('First Landing Page', 'afl-wc-utm-first-referrer'); | |
return $columns; | |
} | |
add_filter('afl_wc_utm_reports_columns', 'afl_wc_utm_first_referrer_column'); | |
function afl_wc_utm_first_referrer_column_data($column, $item) { | |
if ($column === 'first_website_referrer') { | |
echo esc_html($item['first_website_referrer']); | |
} | |
} | |
add_action('afl_wc_utm_reports_column_data', 'afl_wc_utm_first_referrer_column_data', 10, 2); | |
function afl_wc_utm_first_landing_page_column_data($column, $item) { | |
if ($column === 'first_landing_page') { | |
echo esc_html($item['first_landing_page']); | |
} | |
} | |
add_action('afl_wc_utm_reports_column_data', 'afl_wc_utm_first_landing_page_column_data', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment