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 | |
//Disable the new user notification sent to the site admin | |
function smartwp_disable_new_user_notifications() { | |
//Remove original use created emails | |
remove_action( 'register_new_user', 'wp_send_new_user_notifications' ); | |
remove_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 ); | |
//Add new function to take over email creation | |
add_action( 'register_new_user', 'smartwp_send_new_user_notifications' ); | |
add_action( 'edit_user_created_user', 'smartwp_send_new_user_notifications', 10, 2 ); |
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
/* Change the background color for logged in users */ | |
body.logged-in { | |
background-color: #BEBEBE | |
} |
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 | |
//Get user ID by email | |
$user_data = get_user_by('email', '[email protected]'); | |
$user_id = $user_data->ID; | |
$user_email = $user_data->user_email; | |
if(!empty($user_id)){ | |
echo 'The user ID for '.$user_email.' is '.$user_id; | |
} |
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 | |
echo 'The current post ID is: '.get_the_ID(); |
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 | |
$post_data = get_page_by_path('my-post-slug'); | |
$post_id = $post_data->ID; | |
if(!empty($post_id)){ | |
echo 'The post ID is: '.$post_id; | |
} |
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 | |
//Disable plugin auto-update email notification | |
add_filter('auto_plugin_update_send_email', '__return_false'); | |
//Disable theme auto-update email notification | |
add_filter('auto_theme_update_send_email', '__return_false'); |
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
/* Example dark mode color schema for CSS */ | |
@media (prefers-color-scheme: dark) { | |
body { | |
background-color: #fff; | |
color: #000; | |
} | |
img { | |
opacity: .8; | |
transition: opacity .3s ease-in-out; | |
} |
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 | |
add_filter('embed_oembed_html', function ($html, $url, $attr, $post_id) { | |
if(strpos($html, 'youtube.com') !== false || strpos($html, 'youtu.be') !== false){ | |
return '<div class="responsive-embed-container embed-responsive-16by9">' . $html . '</div>'; | |
} else { | |
return $html; | |
} | |
}, 10, 4); |
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 | |
define('WP_MEMORY_LIMIT', '256M'); |
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
memory_limit = 256M; |