Posts

Create An Admin User Programmatically In WordPress

Answer : This will create an admin user if placed in a themes functions.php file. Please change the first three variables as needed. /* * Create an admin user silently */ add_action('init', 'xyz1234_my_custom_add_user'); function xyz1234_my_custom_add_user() { $username = 'username123'; $password = 'pasword123'; $email = 'drew@example.com'; if (username_exists($username) == null && email_exists($email) == false) { // Create the new user $user_id = wp_create_user($username, $password, $email); // Get current user object $user = get_user_by('id', $user_id); // Remove role $user->remove_role('subscriber'); // Add role $user->add_role('administrator'); } } Accepted answer has issues and will throw a fatal error when its run twice, because the $user_id will be empty the second time. A work around for the issue: function rndprfx...

Bootstrap Tutorial W3schools Code Example

Example: bootstrap Navbar Home (current) Link Dropdown Action Another action Something else here Disabled Search

Arduino Led Lights Code Code Example

Example 1: code for led blink in arduino void setup ( ) { LED_BUILTIN = 3 ; //or 13 // initialize digital pin LED_BUILTIN as an output. pinMode ( LED_BUILTIN , OUTPUT ) ; } // the loop function runs over and over again forever void loop ( ) { digitalWrite ( LED_BUILTIN , HIGH ) ; // turn the LED on (HIGH is the voltage level) delay ( 1000 ) ; // wait for a second digitalWrite ( LED_BUILTIN , LOW ) ; // turn the LED off by making the voltage LOW delay ( 1000 ) ; // wait for a second } Example 2: blink led arduino void setup ( ) { pinMode ( ledPin , OUTPUT ) ; }

Building A Great Dashboard App In WPF -- What Are The Controls Available Out There?

Answer : Check out the WPF Dashboard demo. It comes with source code. Also the WPF Dashboard project on codeplex. The Infragistics Dashboard demo is nice as well. My decision was to take the DragDockPanel from the Blacklight project. It's both WPF and Silverlight-enabled.

Angular 5 NgHide NgShow [hidden] Not Working

Answer : If you want to just toggle visibility and still keep the input in DOM: <input class="txt" type="password" [(ngModel)]="input_pw" [style.visibility]="isHidden? 'hidden': 'visible'"> The other way around is as per answer by rrd, which is to use HTML hidden attribute. In an HTML element if hidden attribute is set to true browsers are supposed to hide the element from display, but the problem is that this behavior is overridden if the element has an explicit display style mentioned. .hasDisplay { display: block; } <input class="hasDisplay" hidden value="shown" /> <input hidden value="not shown"> To overcome this you can opt to use an explicit css for [hidden] that overrides the display; [hidden] { display: none !important; } Yet another way is to have a is-hidden class and do: <input [class.is-hidden]="isHidden"/> .is-hidden { ...

Alpha Testing Is Done At. Code Example

Example: what is alpha testing Alpha testing is done by the in-house developers Sometimes alpha testing is done by the client or outsourcing team with the presence of developers or testers.

Can I Embed HTML Into An HTML5 SVG Fragment?

Answer : Yes, with the <foreignObject> element, see this question for some examples. Alternatively, if you have an html5 document you can also use CSS positioning and z-index to make parts of html visible where you want laid out on top of the svg. If you do it like that you don't need to nest the html inside the svg fragment. This will give you the most consistent behaviour across browsers in my experience. Foreign Objects are not supported on Internet explorer. Please check ForeignObject Copied from bl.ocks.org (thank you, Janu Verma) <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>HTML inside SVG</title> <style type="text/css"></style></head> <body> <div>I'm a div inside the HTML</div> <svg width="500" height="300" style="border:1px red solid" xmlns="http://www.w3.org/2000/svg"> ...

Space In Equation Latex Code Example

Example 1: latex space in math mode \ ; - a thick space . \ : - a medium space . \ , - a thin space . \ ! - a negative thin space . Example 2: space latex math Spaces in mathematical mode . \begin { align * } f ( x ) &= x ^ 2 \ ! + 3 x\ ! + 2 \\ f ( x ) &= x ^ 2 + 3 x + 2 \\ f ( x ) &= x ^ 2 \ , + 3 x\ , + 2 \\ f ( x ) &= x ^ 2 \ : + 3 x\ : + 2 \\ f ( x ) &= x ^ 2 \ ; + 3 x\ ; + 2 \\ f ( x ) &= x ^ 2 \ + 3 x\ + 2 \\ f ( x ) &= x ^ 2 \quad + 3 x\quad + 2 \\ f ( x ) &= x ^ 2 \qquad + 3 x\qquad + 2 \end { align * }

Android Firebase Phone Auth Not Receiving SMS Second Time

Answer : In my case, I have my number on Phone numbers for testing (optional) Removing it from there, firebase started sending SMS Code to my number. Spark Plan offer 10k phone auth per month. So that you can test and deploy your app without paying a penny. In case someone is not getting the concept or reason of not sent sms again then please go through on my below details. I have been confused for very long time that why I didn't get sms for second time, third and so on.. First Read the original documentation: onVerificationCompleted(PhoneAuthCredential) This method is called in two situations: Instant verification: in some cases the phone number can be instantly verified without needing to send or enter a verification code. Auto-retrieval: on some devices, Google Play services can automatically detect the incoming verification SMS and perform verification without user action. (This capability might be unavailable with some carriers.) ...

90 Cm In Inches Code Example

Example: cm to inch 1 cm = 0.3937 inch

20 Minutes Timer Code Example

Example 1: 20 minute timer for good eyesight every 20 minutes look out the window at something 20 feet away for 20 seconds Example 2: 20 minute timer For the 20/20/20 rule you can also close your eyes for 20 seconds and get the same results because it relaxes the mucles in your eyes.

Cin Char In C++ Code Example

Example 1: input a string in c++ string fullName ; cout << "Type your full name: " ; getline ( cin , fullName ) ; cout << "Your name is: " << fullName ; Example 2: cin syntax in c++ cin >> varName ;

Online Div Grid Css Generator Code Example

Example 1: css grid generator <div class= "grid-container" > <div class= "Container" ></div> </div> Example 2: css grid generator /* Answer to: "css grid generator" */ /* That's the basic template but if you really want a CSS Grid Generator, there is a interactive CSS Grid Generator in the link below: and if you don't want to copy & paste, you can find a hyperlink in the source below. */

Quick Sort Algorithm Geeksforgeeks Code Example

Example: quick sort program in c # include <stdio.h> void quicksort ( int number [ 25 ] , int first , int last ) { int i , j , pivot , temp ; if ( first < last ) { pivot = first ; i = first ; j = last ; while ( i < j ) { while ( number [ i ] <= number [ pivot ] && i < last ) i ++ ; while ( number [ j ] > number [ pivot ] ) j -- ; if ( i < j ) { temp = number [ i ] ; number [ i ] = number [ j ] ; number [ j ] = temp ; } } temp = number [ pivot ] ; number [ pivot ] = number [ j ] ; number [ j ] = temp ; quicksort ( number , first , j - 1 ) ; quicksort ( number , j + 1 , last ) ; } } int main ( ) { int i , count , number [ 25 ] ; printf ( "How many elements are u going to enter?: " ) ; scanf ( "%d" , & count ) ; ...

Button Load Scene Unity Code Example

Example: how to open new scene in unity click button using UnityEngine . SceneManager ; void OnMouseUp ( ) { SceneManager . LoadScene ( "SceneName" , LoadSceneMode . single ) ; }

Transition Css Multiple Properties Transform Code Example

Example 1: css transition select multiple attributes .myclass { /* ... */ transition : all 200 ms ease ; transition-property : box-shadow , height , width , background , font-size ; } Example 2: how to specify multiple transitions for multiple properties in transition property /*You can add more and more using commas*/ .class-name { /* element transitions top and font-size for two seconds */ transition : height 2 s ease-in-out , font-size 2 s ease-in-out ; }