Skip to content

Instantly share code, notes, and snippets.

View lajennylove's full-sized avatar
🚀
I'm going to have to science the shit out of this.

Jenny Martinez lajennylove

🚀
I'm going to have to science the shit out of this.
View GitHub Profile
@devinsays
devinsays / example-ajax-enqueue.php
Last active January 27, 2025 15:51
Simple WordPress Ajax Example
<?php
function example_ajax_enqueue() {
// Enqueue javascript on the frontend.
wp_enqueue_script(
'example-ajax-script',
get_template_directory_uri() . '/js/simple-ajax-example.js',
array( 'jquery' )
);
@dustyf
dustyf / gist:b6e72a7a7fd05de9598e
Last active January 31, 2025 18:00
Example WordPress Simple JSON Endpoint Plugin
<?php
/**
* Plugin Name: WDS GIF API
* Plugin URI: http://webdevstudios.com
* Description: Adds a Custom Post Type to store GIFs and an API JSON Endpoint to access GIFs by a tag.
* Author: WebDevStudios
* Author URI: http://webdevstudios.com
* Version: 1.0.0
* License: GPLv2
*/
@cobyism
cobyism / gh-pages-deploy.md
Last active May 20, 2025 01:15
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).