?> </th> <th><?php _e('Converted', 'affiliate-wp'); ?> </th> <th><?php _e('Conversion Rate', 'affiliate-wp'); ?> </th> </tr> </thead> <tbody> <?php if ($campaigns = affwp_get_affiliate_campaigns(affwp_get_affiliate_id())) { ?> <?php foreach ($campaigns as $campaign) { ?> <tr> <td><?php echo !empty($campaign->campaign) ? esc_html($campaign->campaign) : __('None set', 'affiliate-wp'); ?> </td> <td><?php echo esc_html($campaign->visits); ?> </td> <td><?php echo esc_html($campaign->unique_visits);
/** * Show an affiliate's campaign stats * * [affiliate_campaign_stats] * * @since 1.1.1 */ function affiliate_campaign_stats($atts, $content = null) { if (!(affwp_is_affiliate() && affwp_is_active_affiliate())) { return; } ob_start(); ?> <div id="affwp-affiliate-dashboard-campaign-stats" class="affwp-tab-content"> <table class="affwp-table"> <thead> <tr> <th><?php _e('Campaign', 'affiliatewp-affiliate-area-shortcodes'); ?> </th> <th><?php _e('Visits', 'affiliatewp-affiliate-area-shortcodes'); ?> </th> <th><?php _e('Unique Links', 'affiliatewp-affiliate-area-shortcodes'); ?> </th> <th><?php _e('Converted', 'affiliatewp-affiliate-area-shortcodes'); ?> </th> <th><?php _e('Conversion Rate', 'affiliatewp-affiliate-area-shortcodes'); ?> </th> </tr> </thead> <tbody> <?php if ($campaigns = affwp_get_affiliate_campaigns(affwp_get_affiliate_id())) { ?> <?php foreach ($campaigns as $campaign) { ?> <tr> <td><?php echo !empty($campaign->campaign) ? esc_html($campaign->campaign) : __('None set', 'affiliatewp-affiliate-area-shortcodes'); ?> </td> <td><?php echo esc_html($campaign->visits); ?> </td> <td><?php echo esc_html($campaign->unique_visits); ?> </td> <td><?php echo esc_html($campaign->referrals); ?> </td> <td><?php echo esc_html(affwp_format_amount($campaign->conversion_rate)); ?> %</td> </tr> <?php } ?> <?php } else { ?> <tr> <td colspan="5"><?php _e('You have no referrals or visits that included a campaign name.', 'affiliatewp-affiliate-area-shortcodes'); ?> </td> </tr> <?php } ?> </tbody> </table> <?php do_action('affwp_affiliate_dashboard_after_campaign_stats', affwp_get_affiliate_id()); ?> </div> <?php $content = ob_get_clean(); return do_shortcode($content); }