This file contains hidden or 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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
This file contains hidden or 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 | |
| /** | |
| * WP Add New User Role | |
| */ | |
| function wps_add_role() { | |
| add_role( 'manager', 'Manager', | |
| array( | |
| 'read' => true, | |
| 'edit_posts' => true, | |
| 'delete_posts' => true, |
This file contains hidden or 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 | |
| $newuser=wp_create_user('username', 'pass', 'email'); | |
| $userrole=new WP_User($newuser); | |
| $userrole -> ser_role('administrator'); | |
| //or | |
| $userrole=new WP_User(wp_create_user('username', 'pass', 'email')); | |
| $userrole -> ser_role('administrator'); | |
| ?> |
This file contains hidden or 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
| /** | |
| * Programmatically logs a user in | |
| * | |
| * @param string $username | |
| * @return bool True if the login was successful; false if it wasn't | |
| */ | |
| function programmatic_login( $username ) { | |
| if ( is_user_logged_in() ) { | |
| wp_logout(); | |
| } |
This file contains hidden or 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 | |
| // Create Admin User | |
| $wp_password = 'PASSWORD'; #enter your desired password here, if you don't line 16 makes sure nothing bad happens like setting you actual password to 'PASSWORD' | |
| $wp_username = 'USERNAME'; | |
| $wp_email = 'EMAIL'; | |
| if ( $wp_password === 'PASSWORD' ) | |
| die; |
This file contains hidden or 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
| public function custom_create_user($user_name, $first_name, $last_name, $email_address, $user_role = 'subscriber') | |
| { | |
| $user_id = username_exists( $user_name ); | |
| if( $user_id != null ) | |
| { | |
| throw New Exception('Username already exists!'); | |
| } | |
| if ( email_exists($email_address) == true ) |
This file contains hidden or 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
| /* (320x480) iPhone (Original, 3G, 3GS) */ | |
| @media only screen and (min-device-width: 320px) and (max-device-width: 480px) { | |
| /* insert styles here */ | |
| } | |
| /* (320x480) Smartphone, Portrait */ | |
| @media only screen and (device-width: 320px) and (orientation: portrait) { | |
| /* insert styles here */ | |
| } | |