Skip to content

Instantly share code, notes, and snippets.

View yckelvin's full-sized avatar

Kelvin Lee yckelvin

View GitHub Profile
@soderlind
soderlind / dropzonejs-wp-rest-api.js
Last active July 27, 2024 11:21
DropzoneJS & WordPress REST API
/*
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
@tophtucker
tophtucker / README.md
Last active April 10, 2017 19:17
Fluid/responsive Bloomberg video player

Wraps the Bloomberg video player in a fluid container that maintains aspect ratio.

  1. Click the 'Share' button and copy the embed code from a Bloomberg video
  2. Paste where it says <!-- PASTE STANDARD EMBED CODE HERE -->
  3. In the embed code, change "offsite_embed":true to "offsite_embed":false

N.B.: The video-wrapper should not contain anything else! If you want to add a caption or something, do it outside.

@philbirnie
philbirnie / Instructions
Last active January 17, 2023 20:40
Steps to Combine Wordpress and Codeigniter when CI is in a subdirectory of Wordpress
Instructions
1. Add MY_url_helper.php to CI_directory/application/helpers
2. If the CI app is already built, convert any references to *site_url* in your CI application (aside from the system directory) to the new namespaced function, ci_site_url.
This step prevents Wordpress' site_url function from overwriting CIs. Because both functions are global and CI checks to make sure that site_url has not been set. Once we load the WP bootstrap file, it will have been defined, so CI's function wll never load.
3. Add Wordpress' bootstrap file into CI_directory/index.php right above CI's bootstrap file.
4. Update wp-includes/load.php *(this is necessary if you are using CI's sessions - Wordpress mangles CI's cookies using with magic quotes. (There may be an upgrade-proof way to do this.)