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
/** | |
* Add custom text on feature image Custom Post Type | |
* | |
* https://www.nuno-sarmento.com | |
*/ | |
add_action( 'admin_head', 'ns_remove_my_meta_boxen' ); | |
function ns_remove_my_meta_boxen() { | |
remove_meta_box( 'postimagediv', 'staff', 'side' ); | |
add_meta_box('postimagediv', __('Add staff photo W 750px x H 400px'), 'post_thumbnail_meta_box', 'staff', 'side', 'high'); |
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
/** | |
* Disabled admin notices | |
* | |
* https://www.nuno-sarmento.com | |
*/ | |
add_action('admin_enqueue_scripts', 'ds_admin_theme_style'); | |
add_action('login_enqueue_scripts', 'ds_admin_theme_style'); | |
function ds_admin_theme_style() { | |
if (!current_user_can( 'manage_options' )) { | |
echo '<style>.update-nag, .updated, .error, .is-dismissible { display: none; }</style>'; |
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
$('.toggle__categories').click(function(e) { | |
e.preventDefault(); | |
var $this = $(this); | |
$this.next().toggleClass(); | |
$this.next().slideToggle(); | |
}); | |
$(function() { | |
$('.plus-minus-toggle').on('click', function() { | |
$(this).toggleClass('collapsed'); |
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
function wpa_admin_notice() { | |
$screen = get_current_screen(); | |
if( 'your_post_type' == $screen->post_type | |
&& 'edit' == $screen->base ){ | |
?> | |
<div class="updated"> | |
<p>Here is some text</p> | |
</div> | |
<?php | |
} |
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
/** | |
* Creates the new widget section to the administration dashboard if the user has the administrator user role. | |
* | |
* https://www.nuno-sarmento.com | |
*/ | |
add_action('wp_dashboard_setup', 'm1ka_online_users_widget'); | |
function m1ka_online_users_widget() { | |
if ( current_user_can( 'manage_options' ) ) { | |
wp_add_dashboard_widget( 'm1ka_online_users', 'Users Stats', 'm1ka_online_users' ); | |
} |
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
/** | |
* Custom dashboard widget | |
*/ | |
add_action('wp_dashboard_setup', 'ns_custom_dashboard_widgets'); | |
function ns_custom_dashboard_widgets() { | |
global $wp_meta_boxes; | |
wp_add_dashboard_widget('custom_help_widget', 'Website Support', 'custom_dashboard_help'); |
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 | |
global $current_user; | |
get_currentuserinfo(); | |
if (is_user_logged_in() && $current_user->ID == $post->post_author) { | |
// Build a list of attendees | |
$attendeeList = TribeEventsTickets::get_event_attendees($event_id); | |
$customerList = array(); |
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
add_action('admin_head', 'ns_custom_style'); | |
function ns_custom_style() { | |
echo '<style> | |
body, td, textarea, input, select { | |
font-family: "Lucida Grande"; | |
font-size: 12px; | |
} | |
</style>'; | |
} |
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
/** | |
* Force users to use the ocean colour scheme | |
* | |
* https://www.nuno-sarmento.com | |
*/ | |
function aet_change_admin_color( $result ) { | |
return 'ocean'; | |
} | |
add_filter( 'get_user_option_admin_color', 'aet_change_admin_color' ); |
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
/** | |
* This function makes posts in the admin filterable by the author. | |
* | |
* https://www.nuno-sarmento.com | |
*/ | |
function ns_filter_by_the_author() { | |
$params = array( | |
'name' => 'author', // this is the "name" attribute for filter <select> | |
'show_option_all' => 'All authors' // label for all authors (display posts without filter) | |
); |