Originally found on galleria.us
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
|---|---|---|---|---|---|---|---|---|
| RED | I | D | B | H | M | L | J | G |
| GREEN | I | D | E | C | A | B | H | O |
| BLUE | E | G | C | D | L | J | F | M |
| PURPLE | F | M | H | G | A | I | J | D |
Originally found on galleria.us
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
|---|---|---|---|---|---|---|---|---|
| RED | I | D | B | H | M | L | J | G |
| GREEN | I | D | E | C | A | B | H | O |
| BLUE | E | G | C | D | L | J | F | M |
| PURPLE | F | M | H | G | A | I | J | D |
Write a wordpress plugin that will allow a person to add a term to the category taxonomy. The form will ask the user for the name of the category. The form will be presented on a page on the front end of the site. The form should be implemented via a shortcode. The form should submit the data via admin-ajax.
| <?php | |
| /* | |
| Plugin Name: Category Term Updater | |
| Prompt given : Write a wordpress plugin that will present a list of category terms, | |
| and allow a person to update them via a form. The form will be presented on a page | |
| on the front end of the site. The form should be implemented via a shortcode. | |
| */ | |
| function category_term_updater_shortcode() { | |
| // Get the current category terms |
| <?php | |
| function my_merge( $a, $d ) { | |
| foreach ( $d as $name => $default ) { | |
| if ( array_key_exists( $name, $a ) && !is_null($a[ $name ]) ) { | |
| $out[ $name ] = $a[ $name ]; | |
| } else { | |
| $out[ $name ] = $default; | |
| } | |
| } |
| <?php | |
| $local_file = 'file_path'; //path to a local file on your server | |
| $post_fields = array( | |
| 'name' => 'value', | |
| ); | |
| $boundary = wp_generate_password( 24 ); | |
| $headers = array( | |
| 'content-type' => 'multipart/form-data; boundary=' . $boundary, | |
| ); |
| <?php | |
| /* | |
| Plugin Name: WI Verbs Nested Post Types | |
| Plugin URI: https://wisconsinverbs.com | |
| Description: Display Custom Post Types in a nested menu | |
| Version: 1.0 | |
| Author: Andrea Roenning | |
| Author URI: https://andrearoenning.com | |
| License: GPL2 | |
| License URI: https://www.gnu.org/licenses/gpl-2.0.html |
You can play with the GraphQL API live here. It's pretty nice and has autocompletion based on the GraphQL schema.
The first example gets your first 3 starred repos, the cursor values can be used for pagination.
Here's an example response from the first query:
{| <style> | |
| body { | |
| margin: 0; | |
| } | |
| .card { | |
| width: 75px; | |
| border:1px solid #ccc; | |
| background-color: #eaeaea; | |
| height: 75px; |
| // so i have two strings i get from a database, an action, and a callback function name | |
| // let's say the action = 'comment_post', and the function name is 'my_comment_post' | |
| // i want to add an action that is basically add_action( 'comment_post', 'my_comment_post' ); | |
| // but i want to do this dynamically for any and all entries i have in the database | |
| // how? | |
| // in my plugin init i had this code, but it wasn't working | |
| // $results->callback would be "my_comment_post" | |
| // $results->hook would be 'comment_post' |
| function updateUserNicename( $user_id, $posted_field_ids, $errors, $old_values, $new_values ) | |
| { | |
| $old_nicename = wp_cache_get( 'bp_user_username_' . $user_id, 'bp' ); | |
| if ( empty( $errors ) ) { | |
| // update user_nicename | |
| // field 2 = first name | |
| // field 3 = last name | |
| $new_nicename = $new_values[2]['value'] . '-' . $new_values[3]['value']; | |
| // update user_nicename |