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 if (isset($_POST['action']) == "wp_inserir_usuario"): ?> | |
| <?php if (wp_verify_nonce($_POST['inserir_usuario_field'],'inserir_usuario_action')): ?> | |
| <?php | |
| $userdata = array( | |
| 'nickname' => $_POST['user_name'], | |
| 'user_login' => $_POST['user_name'], | |
| 'user_email' => $_POST['user_mail'], | |
| 'user_pass' => $_POST['user_pass'], | |
| 'role' => $_POST['user_role'], |
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
| #overlay { | |
| background: #000; | |
| background: rgba(0, 0, 0, 0.3); | |
| display: block; | |
| float: left; | |
| height: 100%; | |
| left: 0; | |
| position: fixed; | |
| top: 0; | |
| width: 100%; |
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
| /* | |
| Uploading images is a two step process (from https://github.com/WP-API/WP-API/issues/1768#issuecomment-160540932): | |
| POST the data to /wp/v2/media - this can either be as the request body, or in multipart format. This will upload the file, and give you a 201 Created response with a Location header. This header points to the post object for the attachment that has just been created. | |
| PUT the post data to the endpoint returned in the Location header (which will look something like /wp/v2/media/{id}). | |
| I do step 2 (PUT), if POST is a success, in myDropzone.on("success", function(file, response){} | |
| */ | |
| // dropzoneWordpressRestApiForm is the configuration for the element that has an id attribute |
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 | |
| // 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'); | |
| // ---------------------------------------------------- |
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
| /** | |
| * mm_register function. | |
| * Register a new user. | |
| * @access public | |
| * @return User errors or user is logged in. | |
| */ | |
| function mm_register() { | |
| if(!is_user_logged_in()) { | |
| if(!empty($_POST)) { |
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 | |
| //absolute path to wp-load.php, or relative to this script | |
| //e.g., ../wp-core/wp-load.php | |
| include( 'trunk/wp-load.php' ); | |
| //grab the WPDB database object, using WP's database | |
| //more info: http://codex.wordpress.org/Class_Reference/wpdb | |
| global $wpdb; |
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
| //How to edit a user profile on the front end? | |
| //http://wordpress.stackexchange.com/questions/9775/how-to-edit-a-user-profile-on-the-front-end | |
| //Forcing nickname as display_name in custom edit profile template | |
| //http://wordpress.stackexchange.com/questions/35403/forcing-nickname-as-display-name-in-custom-edit-profile-template | |
| /////// | |
| <?php |
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 /* This function attaches the image to the post in the database, add it to functions.php */ | |
| function insert_attachment($file_handler,$post_id,$setthumb='false') { | |
| // check to make sure its a successful upload | |
| if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false(); | |
| require_once(ABSPATH . "wp-admin" . '/includes/image.php'); | |
| require_once(ABSPATH . "wp-admin" . '/includes/file.php'); | |
| require_once(ABSPATH . "wp-admin" . '/includes/media.php'); |
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
| // Gravity Forms anchor - disable auto scrolling of forms | |
| add_filter("gform_confirmation_anchor", create_function("","return false;")); |
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 | |
| $playlistID = 'YOUR_PLAYLIST_ID_GOES_HERE'; //Playlist ID, do not include "PL" that is usually in the beginning of a Playlist ID | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, 'https://gdata.youtube.com/feeds/api/playlists/' . $playlistID . '?v=2&alt=json'); | |
| curl_setopt($ch, CURLOPT_HEADER, 0); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($ch, CURLOPT_TIMEOUT, 10); | |
| $output = curl_exec($ch); |