• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
SnippetPress

SnippetPress

The Home of WordPress Snippets

Vultr Web Hosting
  • Cheat Sheets
  • Reviews
  • Snippets
  • Tutorials

AffiliateWP – Add a Custom Tab to the Affiliate Area

June 25, 2020 by SnippetPress Leave a Comment

The Affiliate Area in AffiliateWP has several tabs at the top of the page, like “Affiliate URLs”, “Statistics”, “Graphs” etc. These are all really handy for your affiliates, but what if you want to add your own tab with your own content? It’s really easy with the following snippet:

add_filter( 'affwp_affiliate_area_tabs', 'snippetpress_affwp_custom_tab' );
function snippetpress_affwp_custom_tab( $tabs ){	
	$tabs['custom-tab'] = 'Custom Tab';	
	return $tabs;	
}

add_filter( 'affwp_render_affiliate_dashboard_tab_custom-tab', 'snippetpress_affwp_custom_tab_contents' );
function snippetpress_affwp_custom_tab_contents( $content ){	
	return 'Our custom content goes here!';	
}

As you can see, this will add a custom tab to the AffiliateWP Affiliate Area.

In the example above, we used a slug custom-tab for our custom tab. You need to make sure that this slug is the same in both parts of the code snippet:

Where to add the snippet?

The snippet should be placed at the bottom of the functions.php file of your child theme. Make sure you know what you’re doing when editing this file. Alternatively, you can use a plugin such as Code Snippets to add the custom code to your WordPress site. If you need further guidance on how to add the code, check out our post on How to Add WordPress Snippets.

Filed Under: AffiliateWP, Snippets, Snippets

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

E-mail Newsletter

More to See

WooCommerce – Prevent Product Being Added To Cart If A Specific Product Is Already In Cart

July 15, 2020 By SnippetPress

WooCommerce – Display an “Add $X To Get Free Shipping” Notice

July 13, 2020 By SnippetPress

Footer

Recent

  • Change The WordPress Page Title Separator Without A Plugin
  • WooCommerce – Prevent Product Being Added To Cart If A Specific Product Is Already In Cart
  • WooCommerce – Display an “Add $X To Get Free Shipping” Notice
  • WooCommerce – Integrate Google Merchant Center Customer Reviews
  • WooCommerce – Disable Out of Stock Variations

Search

Copyright © 2023 ·SnippetPress