Affiliates > Groups Menu | WordPress.org

[ad_1]

Hey @10bradders10,

Thank you for reaching out! The “Groups” menu item is registered using the same method used for all of our other pages.

The two differences are:

  1. We’re registering it only when the Affiliates and Groups pages are in view.
  2. We’ve prepended an icon to the menu item’s text.

I’m guessing that because point #1, you’re not seeing the menu item as selectable in SolidWP.

I’m afraid that, for the time being, we will not modifying the way this works, as we do not want to show the menu item all the time.

However, as a workaround, you can use this code snippet:

/**
 * Register the Affiliate Groups admin submenu page.
 * 
 * @param array $submenu_pages
 * 
 * @return array
 *
 */
function slicewp_custom_register_submenu_page_affiliate_groups( $submenu_pages ) {

    if ( empty( $_GET['page'] ) ) {
        return $submenu_pages;
    }

	if ( ! is_array( $submenu_pages ) ) {
		return $submenu_pages;
	}

	$submenu_pages['affiliate_groups'] = array(
		'class_name' => 'SliceWP_Submenu_Page_Affiliate_Groups',
		'data' 		 => array(
			'page_title' => __( 'Groups', 'slicewp' ),
			'menu_title' => '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 20 20"><path fill="currentColor" d="M10.72 16.78a.75.75 0 0 0 1.06 0l4-4a.75.75 0 0 0 0-1.06l-4-4a.75.75 0 1 0-1.06 1.06l2.72 2.72H7A1.5 1.5 0 0 1 5.5 10V3.75a.75.75 0 0 0-1.5 0V10a3 3 0 0 0 3 3h6.44l-2.72 2.72a.75.75 0 0 0 0 1.06Z"></path></svg>' . __( 'Groups', 'slicewp' ),
			'capability' => apply_filters( 'slicewp_submenu_page_capability_affiliate_groups', 'manage_options' ),
			'menu_slug'  => 'slicewp-affiliate-groups'
		)
	);

	return $submenu_pages;

}
remove_filter( 'slicewp_register_submenu_page', 'slicewp_register_submenu_page_affiliate_groups', 20 );
add_filter( 'slicewp_register_submenu_page', 'slicewp_custom_register_submenu_page_affiliate_groups', 20 );

This will decouple our own page registration callback and couple a custom registration function that does not take into account point #1.

Please copy the code and add it to your website. If you’re not sure how to add code snippets to your site, you can use the Code Snippets plugin (https://projectdmc.org/plugins/code-snippets/).

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