Add custom Tab and Content to dashboard

[ad_1]

Hey @pdutie94,

Thank you for reaching out! You can add custom tabs only through code. Currently, we don’t have a user interface for this.

Here’s the code you’d need to add to your website:

/**
 * Registers an affiliate account tab right before the "Creatives" tab.
 *
 */
function slicewp_affiliate_account_tabs_example( $tabs ) {

	$tabs = array_merge( 
		array_slice( $tabs, 0, array_search( 'creatives', array_keys( $tabs ) ) ),
		array( 
			'example' => array(
				'label' => __( 'Example', 'slicewp' ),
				'icon'  => slicewp_get_svg( 'outline-tag' )
			)),
		array_slice( $tabs, array_search( 'creatives', array_keys( $tabs ) ), count( $tabs ) )
	);

	return $tabs;

}
add_filter( 'slicewp_affiliate_account_tabs', 'slicewp_affiliate_account_tabs_example' );

/**
 * Outputs the "example" tab content in the affiliate account page.
 *
 */
function slicewp_affiliate_account_tab_content_example( $slug, $name, $templates, $args ) {

	if ( 'affiliate-area/affiliate-account-tab-example' != $slug )
		return;

	?>

		<!-- HTML content goes here -->

	<?php

}
add_action( 'slicewp_get_template_part', 'slicewp_affiliate_account_tab_content_example', 10, 4 );

The code features two functions. One to register the new tab and one to output the tab’s content. Please adapt the code as you need it.

Also, if you’re not sure where to add this code to your website, you can use a plugin such as the Code Snippets plugin ).

Please try it out and let me know how it goes.

Thank you and best wishes,
Mihai

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer