Skip to content

Instantly share code, notes, and snippets.

View Nerd-Rush's full-sized avatar

Nathan Rollag Nerd-Rush

View GitHub Profile
@Nerd-Rush
Nerd-Rush / wp-discourage-se-alert.txt
Last active January 11, 2025 02:56
Discourage Search Engine Alert - WordPress
add_action('admin_head', 'custom_admin_bar_color');
add_action('wp_head', 'custom_admin_bar_color');
function custom_admin_bar_color() {
// Check if the "Discourage search engines from indexing this site" setting is enabled
if (get_option('blog_public') == '0') {
// Output CSS to change the admin bar color
echo '<style>
#wpadminbar {
border-top: 5px solid #cf0000 !important;
@Nerd-Rush
Nerd-Rush / gist:56296e0b1179de099b546519f1354f55
Last active August 7, 2024 13:24
WordPress Admin Menu Organizer
function move_plugins_to_end() {
global $menu;
$plugin_menus = [];
$non_plugin_menus = [];
if (!isset($menu) || !is_array($menu)) {
return; // Exit if $menu is not properly set
}
@Nerd-Rush
Nerd-Rush / gist:e15c7fa8603c0bfc1d0af89beeada3ee
Last active March 14, 2024 18:14
Ads Online - bootlegproducts.com
add_action( 'woocommerce_thankyou', 'my_custom_tracking' );
if ( ! function_exists( 'custom_meta_to_order' ) ) {
add_action( 'woocommerce_checkout_create_order', 'custom_meta_to_order', 20, 1 );
function custom_meta_to_order( $order ) {
$eftid = isset( $_COOKIE['ef_tid_c_a_1342'] ) ? sanitize_text_field( $_COOKIE['ef_tid_c_a_1342'] ) : '';
$order->update_meta_data( "eftid", $eftid );
}
}
@Nerd-Rush
Nerd-Rush / gist:2269df3f4a2308a61981720f82e9f655
Created December 13, 2023 20:09
Add Footer Credit to WordPress Admin
function wp_admin_footer_text() {
echo '<span style="color:#50575e">Website built by Nerd Rush! For questions or support, please visit our website at <a href="https://nerdrush.com/" target="blank" rel="noopener">www.nerdrush.com</a></span>';
}
add_filter('admin_footer_text', 'wp_admin_footer_text');
@Nerd-Rush
Nerd-Rush / Client editing disclaimer PHP snippet
Last active January 29, 2024 00:15
Dismissable WordPress message to your clients.
// Client editing disclaimer
function custom_admin_notice_with_logo() {
$user_id = get_current_user_id();
if (get_user_meta($user_id, 'custom_notice_dismissed', true) !== 'yes') {
if (current_user_can('administrator') || current_user_can('editor') || current_user_can('author')) {
$nonce = wp_create_nonce('custom_notice_dismiss_nonce');
$image_url = 'https://nerdrush.com/wp-content/uploads/2023/08/Nerd-Rush-Logo-Blue-2023.svg'; // External image URL
?>
<div class="notice notice-warning custom-notice" style="padding-top: 20px;">
<img src="<?php echo esc_url( $image_url ); ?>" alt="Logo" style="width: 120px; display: block; margin-bottom: 10px;">