Skip to content

Instantly share code, notes, and snippets.

@vovafeldman
Created October 6, 2016 15:18
Show Gist options
  • Save vovafeldman/985ca36faae01e595fdf46a2929fb319 to your computer and use it in GitHub Desktop.
Save vovafeldman/985ca36faae01e595fdf46a2929fb319 to your computer and use it in GitHub Desktop.
Highlight admin top level and submenu when viewing freemius pages.
<?php
/**
* Highlight admin top level and submenu when viewing freemius pages
*/
function iconic_ecifw_menu_highlight() {
global $plugin_page, $submenu_file;
if( iconic_ecifw_is_settings_page() ) {
$submenu_file = 'iconic-ecifw-settings';
$plugin_page = 'iconicwp';
}
}
add_action( 'admin_head', 'iconic_ecifw_menu_highlight' );
/**
* Check if we're on the plugin's settings page
*/
function iconic_ecifw_is_settings_page() {
if( !isset( $_GET['page'] ) )
return false;
if( strpos( $_GET['page'], 'iconic-ecifw-' ) === false )
return false;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment