Skip to content

Instantly share code, notes, and snippets.

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 elearningplugins/4783b0b4bdec3f94ced3d9bd62cbf6dd to your computer and use it in GitHub Desktop.
Save elearningplugins/4783b0b4bdec3f94ced3d9bd62cbf6dd to your computer and use it in GitHub Desktop.
AFL WC UTM First Referrer and Landing Page
<?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