Created
October 8, 2024 23:25
-
-
Save mchoiruln/da4a6dc5033cb23fb0b017cf2d1be155 to your computer and use it in GitHub Desktop.
Wordpress rewrite header of users page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
function rewrite_cpt_header() | |
{ | |
$screen = get_current_screen(); | |
error_log(print_r($screen, true)); | |
if ($screen->id != 'users') { | |
return; | |
} else { | |
?> | |
<div class="wrap"> | |
<h1 class="wp-heading-inline show" style="display:inline-block;">Locations</h1> | |
<a href="<?php echo admin_url('post-new.php?post_type=location'); ?>" class="page-title-action show">Add New Location</a> | |
<a href="<?php echo admin_url('edit-tags.php?taxonomy=location_types&post_type=location'); ?>" class="page-title-action show">Edit Location Types</a> | |
</div> | |
<style scoped> | |
.wp-heading-inline:not(.show), | |
.page-title-action:not(.show) { | |
display: none !important; | |
} | |
</style> | |
<?php | |
} | |
} | |
add_action('admin_notices', 'rewrite_cpt_header'); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment