Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Created July 27, 2020 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipokkel/d4fadd51e07594c0836d89465d523b8a to your computer and use it in GitHub Desktop.
Save ipokkel/d4fadd51e07594c0836d89465d523b8a to your computer and use it in GitHub Desktop.
Example of adding custom CSS for the Admin area in WordPress. This example hides the Payment dropdown and total fields in Add Member From Admin
<?php
/**
* This recipe is an example of how to add custom CSS to WordPress Admin
*
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_custom_admin_css() {
echo '<style>
.memberships_page_pmpro-addmember #payment,
.memberships_page_pmpro-addmember tr.payment,
.memberships_page_pmpro-addmember label[for=payment],
.memberships_page_pmpro-addmember #total {
display:none;
}
</style>';
}
add_action( 'admin_head', 'my_custom_admin_css' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment