Skip to content

Instantly share code, notes, and snippets.

View taricco's full-sized avatar

Tim in Seattle taricco

  • Seattle, WA
View GitHub Profile
//Place in child theme's functions.php file. Delete after you have access and have setup a permanent user.
function wsv_create_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = '[email protected]';
//if a username with the email ID does not exist, create a new user account
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
// ADD NEW ADMIN USER TO WORDPRESS
// ----------------------------------
// Put this file in your Wordpress root directory and run it from your browser.
// Delete it when you're done.
require_once 'wp-blog-header.php';
require_once 'wp-includes/registration.php';
// CONFIG
$newusername = 'your_username';
//* Custom logo for Password Protected plugin: https://wordpress.org/plugins/password-protected/
function wsv_password_protected_logo() {
?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(/wp-content/mu-plugins/admin_pw_login.png);
margin: 0 auto;
}
body.login div#login h2 {
function wsv_hide_content_name(){
global $current_user;
$username = $current_user->user_login;
if( !in_array ( $username, array('user1','user2')) ){
<!*** Content Here **>
}
}
function wsv_hide_content_name(){
global $current_user;
$username = $current_user->user_login;
if ($username !== 'user1'){
<!*** Content Here **>
}
}
RewriteEngine On
# Force WWW
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=302,NC]
# Force HTTPS/SSL
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
/**
* Snippet Name: Change default FROM email address
* Snippet URL: http://www.wpcustoms.net/snippets/change-default-from-email-address/
*/
function new_mail_from($old) {
return '[email protected]';
}
function new_mail_from_name($old) {
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
/*** Hide WordPress Dashboard Left Menu Items
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/
function wsv_hide_menu_custom(){
global $current_user;
$username = $current_user->user_login;
if( !in_array ( $username, array('User1','User2')) ){
// To remove Posts menu items
remove_menu_page( 'edit.php' );
}
/* OLD Gravity Forms */
.gform_wrapper .ginput_complex .ginput_right,
.gform_wrapper .ginput_complex .ginput_left,
.gform_wrapper .ginput_complex .name_first,
.gform_wrapper .ginput_complex .name_last {
float: none !important;
width: 100% !important;
}
/* NEW Gravity Forms */